aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-18 23:42:22 +0800
committerGitHub <noreply@github.com>2018-12-18 23:42:22 +0800
commitd959407f66d91ec5f7b05947193d58ae5b9468a9 (patch)
tree6cdae91569a5638a5064028a8e0085aeb6d8e640 /test
parenta51a8368aaa44bd1b26eb6869b107f6f3b3eec05 (diff)
parentbd2f2ecbbd20f8d861d7a068954ea2e27d7f02be (diff)
downloaddexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar.gz
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar.bz2
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar.lz
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar.xz
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.tar.zst
dexon-solidity-d959407f66d91ec5f7b05947193d58ae5b9468a9.zip
Merge pull request #5674 from ethereum/parser-pragmaversion
Add version pragma parsing to Parser
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/AnalysisFramework.cpp2
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp12
-rw-r--r--test/libsolidity/SolidityParser.cpp17
3 files changed, 18 insertions, 13 deletions
diff --git a/test/libsolidity/AnalysisFramework.cpp b/test/libsolidity/AnalysisFramework.cpp
index 8a72f996..abeecd32 100644
--- a/test/libsolidity/AnalysisFramework.cpp
+++ b/test/libsolidity/AnalysisFramework.cpp
@@ -52,7 +52,7 @@ AnalysisFramework::parseAnalyseAndReturnError(
m_compiler.setEVMVersion(dev::test::Options::get().evmVersion());
if (!m_compiler.parse())
{
- BOOST_ERROR("Parsing contract failed in analysis test suite:" + formatErrors());
+ BOOST_FAIL("Parsing contract failed in analysis test suite:" + formatErrors());
}
m_compiler.analyze();
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 75726027..774f67fe 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -376,18 +376,6 @@ BOOST_AUTO_TEST_CASE(warn_nonpresent_pragma)
BOOST_CHECK(searchErrorMessage(*sourceAndError.second.front(), "Source file does not specify required compiler version!"));
}
-BOOST_AUTO_TEST_CASE(unsatisfied_version)
-{
- char const* text = R"(
- pragma solidity ^99.99.0;
- )";
- auto sourceAndError = parseAnalyseAndReturnError(text, false, false, false);
- BOOST_REQUIRE(!sourceAndError.second.empty());
- BOOST_REQUIRE(!!sourceAndError.first);
- BOOST_CHECK(sourceAndError.second.front()->type() == Error::Type::SyntaxError);
- BOOST_CHECK(searchErrorMessage(*sourceAndError.second.front(), "Source file requires different compiler version"));
-}
-
BOOST_AUTO_TEST_CASE(returndatasize_as_variable)
{
char const* text = R"(
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index d86d3d39..a33c6134 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -113,6 +113,23 @@ while(0)
BOOST_AUTO_TEST_SUITE(SolidityParser)
+BOOST_AUTO_TEST_CASE(unsatisfied_version)
+{
+ char const* text = R"(
+ pragma solidity ^99.99.0;
+ )";
+ CHECK_PARSE_ERROR(text, "Source file requires different compiler version");
+}
+
+BOOST_AUTO_TEST_CASE(unsatisfied_version_followed_by_invalid_syntax)
+{
+ char const* text = R"(
+ pragma solidity ^99.99.0;
+ this is surely invalid
+ )";
+ CHECK_PARSE_ERROR(text, "Source file requires different compiler version");
+}
+
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
{
char const* text = R"(