aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-11-15 00:11:55 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-11-22 03:13:44 +0800
commitd67322a1861d60a88151f7c25d6c3478a9a39acf (patch)
treeaf485e48c3436cd24e2db09a6a1bcf445605bae1 /test
parent80371e2d25ce3eb868d6f75b99a54af9dc6c1583 (diff)
downloaddexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.gz
dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.zst
dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.zip
Introduce namespace `langutil` in liblangutil directory.
Also: - Use {}-style list initialisation for SourceLocation construction - Introduce new system includes - Changes the API of the Scanner to take source as value (with move) as opposed to as a reference
Diffstat (limited to 'test')
-rw-r--r--test/libevmasm/Assembler.cpp1
-rw-r--r--test/libevmasm/Optimiser.cpp1
-rw-r--r--test/liblangutil/SourceLocation.cpp5
-rw-r--r--test/libsolidity/AnalysisFramework.cpp3
-rw-r--r--test/libsolidity/AnalysisFramework.h8
-rw-r--r--test/libsolidity/Assembly.cpp1
-rw-r--r--test/libsolidity/ErrorCheck.cpp1
-rw-r--r--test/libsolidity/ErrorCheck.h4
-rw-r--r--test/libsolidity/GasMeter.cpp1
-rw-r--r--test/libsolidity/InlineAssembly.cpp1
-rw-r--r--test/libsolidity/SMTChecker.cpp1
-rw-r--r--test/libsolidity/SemVerMatcher.cpp1
-rw-r--r--test/libsolidity/SolidityExecutionFramework.h4
-rw-r--r--test/libsolidity/SolidityExpressionCompiler.cpp1
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp1
-rw-r--r--test/libsolidity/SolidityNatspecJSON.cpp2
-rw-r--r--test/libsolidity/SolidityParser.cpp1
-rw-r--r--test/libsolidity/SolidityScanner.cpp1
-rw-r--r--test/libsolidity/SolidityTypes.cpp1
-rw-r--r--test/libsolidity/SyntaxTest.cpp1
-rw-r--r--test/libsolidity/ViewPureChecker.cpp1
-rw-r--r--test/libyul/Common.cpp1
-rw-r--r--test/libyul/Common.h12
-rw-r--r--test/libyul/Parser.cpp1
-rw-r--r--test/libyul/YulOptimizerTest.cpp6
-rw-r--r--test/libyul/YulOptimizerTest.h11
-rw-r--r--test/tools/yulopti.cpp5
27 files changed, 52 insertions, 25 deletions
diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp
index 1c041596..5ad01594 100644
--- a/test/libevmasm/Assembler.cpp
+++ b/test/libevmasm/Assembler.cpp
@@ -30,6 +30,7 @@
#include <memory>
using namespace std;
+using namespace langutil;
using namespace dev::eth;
namespace dev
diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp
index c01e8758..c061b783 100644
--- a/test/libevmasm/Optimiser.cpp
+++ b/test/libevmasm/Optimiser.cpp
@@ -36,6 +36,7 @@
#include <memory>
using namespace std;
+using namespace langutil;
using namespace dev::eth;
namespace dev
diff --git a/test/liblangutil/SourceLocation.cpp b/test/liblangutil/SourceLocation.cpp
index 29cfb6a0..ac7a2173 100644
--- a/test/liblangutil/SourceLocation.cpp
+++ b/test/liblangutil/SourceLocation.cpp
@@ -24,9 +24,7 @@
#include <test/Options.h>
-namespace dev
-{
-namespace solidity
+namespace langutil
{
namespace test
{
@@ -46,5 +44,4 @@ BOOST_AUTO_TEST_CASE(test_fail)
BOOST_AUTO_TEST_SUITE_END()
}
-}
} // end namespaces
diff --git a/test/libsolidity/AnalysisFramework.cpp b/test/libsolidity/AnalysisFramework.cpp
index dafd1748..12d63cb7 100644
--- a/test/libsolidity/AnalysisFramework.cpp
+++ b/test/libsolidity/AnalysisFramework.cpp
@@ -35,6 +35,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
using namespace dev::solidity::test;
@@ -127,7 +128,7 @@ string AnalysisFramework::formatError(Error const& _error) const
return SourceReferenceFormatter::formatExceptionInformation(
_error,
(_error.type() == Error::Type::Warning) ? "Warning" : "Error",
- [&](std::string const& _sourceName) -> solidity::Scanner const& { return m_compiler.scanner(_sourceName); }
+ [&](std::string const& _sourceName) -> Scanner const& { return m_compiler.scanner(_sourceName); }
);
}
diff --git a/test/libsolidity/AnalysisFramework.h b/test/libsolidity/AnalysisFramework.h
index a904617d..391a21da 100644
--- a/test/libsolidity/AnalysisFramework.h
+++ b/test/libsolidity/AnalysisFramework.h
@@ -45,7 +45,7 @@ class AnalysisFramework
{
protected:
- virtual std::pair<SourceUnit const*, ErrorList>
+ virtual std::pair<SourceUnit const*, langutil::ErrorList>
parseAnalyseAndReturnError(
std::string const& _source,
bool _reportWarnings = false,
@@ -56,10 +56,10 @@ protected:
SourceUnit const* parseAndAnalyse(std::string const& _source);
bool success(std::string const& _source);
- ErrorList expectError(std::string const& _source, bool _warning = false, bool _allowMultiple = false);
+ langutil::ErrorList expectError(std::string const& _source, bool _warning = false, bool _allowMultiple = false);
std::string formatErrors() const;
- std::string formatError(Error const& _error) const;
+ std::string formatError(langutil::Error const& _error) const;
static ContractDefinition const* retrieveContractByName(SourceUnit const& _source, std::string const& _name);
static FunctionTypePointer retrieveFunctionBySignature(
@@ -68,7 +68,7 @@ protected:
);
// filter out the warnings in m_warningsToFilter or all warnings if _includeWarnings is false
- ErrorList filterErrors(ErrorList const& _errorList, bool _includeWarnings) const;
+ langutil::ErrorList filterErrors(langutil::ErrorList const& _errorList, bool _includeWarnings) const;
std::vector<std::string> m_warningsToFilter = {"This is a pre-release compiler version"};
dev::solidity::CompilerStack m_compiler;
diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp
index 78fa7bcf..926e29fe 100644
--- a/test/libsolidity/Assembly.cpp
+++ b/test/libsolidity/Assembly.cpp
@@ -39,6 +39,7 @@
#include <iostream>
using namespace std;
+using namespace langutil;
using namespace dev::eth;
namespace dev
diff --git a/test/libsolidity/ErrorCheck.cpp b/test/libsolidity/ErrorCheck.cpp
index fba2c897..e1f48fb2 100644
--- a/test/libsolidity/ErrorCheck.cpp
+++ b/test/libsolidity/ErrorCheck.cpp
@@ -27,6 +27,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
namespace
diff --git a/test/libsolidity/ErrorCheck.h b/test/libsolidity/ErrorCheck.h
index c70a6645..c3a2f522 100644
--- a/test/libsolidity/ErrorCheck.h
+++ b/test/libsolidity/ErrorCheck.h
@@ -30,10 +30,10 @@ namespace dev
{
namespace solidity
{
-bool searchErrorMessage(Error const& _err, std::string const& _substr);
+bool searchErrorMessage(langutil::Error const& _err, std::string const& _substr);
/// Checks that all provided errors are of the given type and have a given substring in their
/// description.
/// If the expectations are not met, returns a nonempty description, otherwise an empty string.
-std::string searchErrors(ErrorList const& _errors, std::vector<std::pair<Error::Type, std::string>> const& _expectations);
+std::string searchErrors(langutil::ErrorList const& _errors, std::vector<std::pair<langutil::Error::Type, std::string>> const& _expectations);
}
}
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index 4887dd5b..61f16c0f 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -29,6 +29,7 @@
#include <libsolidity/interface/SourceReferenceFormatter.h>
using namespace std;
+using namespace langutil;
using namespace dev::eth;
using namespace dev::solidity;
using namespace dev::test;
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index 3079e032..31d21490 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -36,6 +36,7 @@
#include <memory>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp
index 195004cb..13fcc5b4 100644
--- a/test/libsolidity/SMTChecker.cpp
+++ b/test/libsolidity/SMTChecker.cpp
@@ -25,6 +25,7 @@
#include <string>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SemVerMatcher.cpp b/test/libsolidity/SemVerMatcher.cpp
index b2f4b3c2..2e147847 100644
--- a/test/libsolidity/SemVerMatcher.cpp
+++ b/test/libsolidity/SemVerMatcher.cpp
@@ -28,6 +28,7 @@
#include <test/Options.h>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h
index ab71a3e0..d43e994d 100644
--- a/test/libsolidity/SolidityExecutionFramework.h
+++ b/test/libsolidity/SolidityExecutionFramework.h
@@ -72,13 +72,13 @@ public:
m_compiler.setOptimiserSettings(m_optimize, m_optimizeRuns);
if (!m_compiler.compile())
{
- auto scannerFromSourceName = [&](std::string const& _sourceName) -> solidity::Scanner const& { return m_compiler.scanner(_sourceName); };
+ auto scannerFromSourceName = [&](std::string const& _sourceName) -> langutil::Scanner const& { return m_compiler.scanner(_sourceName); };
SourceReferenceFormatter formatter(std::cerr, scannerFromSourceName);
for (auto const& error: m_compiler.errors())
formatter.printExceptionInformation(
*error,
- (error->type() == Error::Type::Warning) ? "Warning" : "Error"
+ (error->type() == langutil::Error::Type::Warning) ? "Warning" : "Error"
);
BOOST_ERROR("Compiling contract failed");
}
diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp
index 37183279..a68eb3df 100644
--- a/test/libsolidity/SolidityExpressionCompiler.cpp
+++ b/test/libsolidity/SolidityExpressionCompiler.cpp
@@ -33,6 +33,7 @@
#include <test/Options.h>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 5ec010c7..75726027 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -33,6 +33,7 @@
#include <string>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp
index 45191ce1..d930f697 100644
--- a/test/libsolidity/SolidityNatspecJSON.cpp
+++ b/test/libsolidity/SolidityNatspecJSON.cpp
@@ -27,6 +27,8 @@
#include <liblangutil/Exceptions.h>
#include <libdevcore/Exceptions.h>
+using namespace langutil;
+
namespace dev
{
namespace solidity
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index cf5461ba..3534dd5b 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -29,6 +29,7 @@
#include <test/libsolidity/ErrorCheck.h>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp
index 53ec0a4c..2d164ae3 100644
--- a/test/libsolidity/SolidityScanner.cpp
+++ b/test/libsolidity/SolidityScanner.cpp
@@ -24,6 +24,7 @@
#include <boost/test/unit_test.hpp>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp
index 6f9d4ce8..c839afd4 100644
--- a/test/libsolidity/SolidityTypes.cpp
+++ b/test/libsolidity/SolidityTypes.cpp
@@ -26,6 +26,7 @@
#include <boost/test/unit_test.hpp>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp
index 91d1681f..45d32b55 100644
--- a/test/libsolidity/SyntaxTest.cpp
+++ b/test/libsolidity/SyntaxTest.cpp
@@ -25,6 +25,7 @@
#include <stdexcept>
using namespace dev;
+using namespace langutil;
using namespace solidity;
using namespace dev::solidity::test;
using namespace dev::solidity::test::formatting;
diff --git a/test/libsolidity/ViewPureChecker.cpp b/test/libsolidity/ViewPureChecker.cpp
index b7ea1efc..64e52604 100644
--- a/test/libsolidity/ViewPureChecker.cpp
+++ b/test/libsolidity/ViewPureChecker.cpp
@@ -28,6 +28,7 @@
#include <tuple>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp
index b351483e..8913483f 100644
--- a/test/libyul/Common.cpp
+++ b/test/libyul/Common.cpp
@@ -37,6 +37,7 @@
#include <boost/test/unit_test.hpp>
using namespace std;
+using namespace langutil;
using namespace dev::yul;
using namespace dev::solidity;
diff --git a/test/libyul/Common.h b/test/libyul/Common.h
index ee191494..390e214f 100644
--- a/test/libyul/Common.h
+++ b/test/libyul/Common.h
@@ -27,13 +27,17 @@
#include <vector>
#include <memory>
-namespace dev
-{
-namespace solidity
+namespace langutil
{
class Scanner;
class Error;
using ErrorList = std::vector<std::shared_ptr<Error const>>;
+}
+
+namespace dev
+{
+namespace solidity
+{
namespace assembly
{
struct AsmAnalysisInfo;
@@ -44,7 +48,7 @@ namespace yul
namespace test
{
-void printErrors(solidity::ErrorList const& _errors, solidity::Scanner const& _scanner);
+void printErrors(langutil::ErrorList const& _errors, langutil::Scanner const& _scanner);
std::pair<std::shared_ptr<solidity::assembly::Block>, std::shared_ptr<solidity::assembly::AsmAnalysisInfo>>
parse(std::string const& _source, bool _yul = true);
solidity::assembly::Block disambiguate(std::string const& _source, bool _yul = true);
diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp
index 3a887176..4aa3dd5c 100644
--- a/test/libyul/Parser.cpp
+++ b/test/libyul/Parser.cpp
@@ -36,6 +36,7 @@
#include <memory>
using namespace std;
+using namespace langutil;
namespace dev
{
diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp
index 57c4d7f0..6b2b81c3 100644
--- a/test/libyul/YulOptimizerTest.cpp
+++ b/test/libyul/YulOptimizerTest.cpp
@@ -21,6 +21,9 @@
#include <test/Options.h>
+#include <liblangutil/ErrorReporter.h>
+#include <liblangutil/Scanner.h>
+
#include <libyul/optimiser/BlockFlattener.h>
#include <libyul/optimiser/VarDeclPropagator.h>
#include <libyul/optimiser/Disambiguator.h>
@@ -41,12 +44,10 @@
#include <libyul/optimiser/RedundantAssignEliminator.h>
#include <libyul/optimiser/Suite.h>
-#include <liblangutil/Scanner.h>
#include <libsolidity/inlineasm/AsmPrinter.h>
#include <libsolidity/inlineasm/AsmParser.h>
#include <libsolidity/inlineasm/AsmAnalysis.h>
#include <libsolidity/interface/SourceReferenceFormatter.h>
-#include <liblangutil/ErrorReporter.h>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>
@@ -54,6 +55,7 @@
#include <fstream>
using namespace dev;
+using namespace langutil;
using namespace dev::yul;
using namespace dev::yul::test;
using namespace dev::solidity;
diff --git a/test/libyul/YulOptimizerTest.h b/test/libyul/YulOptimizerTest.h
index 7db17ceb..d11ff8fb 100644
--- a/test/libyul/YulOptimizerTest.h
+++ b/test/libyul/YulOptimizerTest.h
@@ -19,14 +19,17 @@
#include <test/libsolidity/TestCase.h>
+namespace langutil
+{
+class Scanner;
+class Error;
+using ErrorList = std::vector<std::shared_ptr<Error const>>;
+}
namespace dev
{
namespace solidity
{
-class Scanner;
-class Error;
-using ErrorList = std::vector<std::shared_ptr<Error const>>;
namespace assembly
{
struct AsmAnalysisInfo;
@@ -58,7 +61,7 @@ private:
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
void disambiguate();
- static void printErrors(std::ostream& _stream, solidity::ErrorList const& _errors, solidity::Scanner const& _scanner);
+ static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors, langutil::Scanner const& _scanner);
std::string m_source;
bool m_yul = false;
diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp
index df5331f7..8bc807d4 100644
--- a/test/tools/yulopti.cpp
+++ b/test/tools/yulopti.cpp
@@ -19,15 +19,15 @@
*/
#include <libdevcore/CommonIO.h>
+#include <liblangutil/ErrorReporter.h>
+#include <liblangutil/Scanner.h>
#include <libsolidity/inlineasm/AsmAnalysis.h>
#include <libsolidity/inlineasm/AsmAnalysisInfo.h>
-#include <liblangutil/Scanner.h>
#include <libsolidity/parsing/Parser.h>
#include <libsolidity/inlineasm/AsmData.h>
#include <libsolidity/inlineasm/AsmParser.h>
#include <libsolidity/inlineasm/AsmPrinter.h>
#include <libsolidity/interface/SourceReferenceFormatter.h>
-#include <liblangutil/ErrorReporter.h>
#include <libyul/optimiser/BlockFlattener.h>
#include <libyul/optimiser/Disambiguator.h>
@@ -58,6 +58,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
using namespace dev::solidity::assembly;
using namespace dev::yul;