From 591ba184e902386aeed3cc44792a59f479a4a7f2 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Tue, 12 Oct 2021 15:13:35 +0200 Subject: [PATCH] Adds some more version pragma test cases. --- test/libsolidity/SemVerMatcher.cpp | 2 ++ test/libsolidity/syntaxTests/pragma/broken_version_6.sol | 3 +++ test/libsolidity/syntaxTests/pragma/broken_version_7.sol | 3 +++ test/libsolidity/syntaxTests/pragma/version_range.sol | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 test/libsolidity/syntaxTests/pragma/broken_version_6.sol create mode 100644 test/libsolidity/syntaxTests/pragma/broken_version_7.sol create mode 100644 test/libsolidity/syntaxTests/pragma/version_range.sol diff --git a/test/libsolidity/SemVerMatcher.cpp b/test/libsolidity/SemVerMatcher.cpp index b0fbb8547..a69b2a39d 100644 --- a/test/libsolidity/SemVerMatcher.cpp +++ b/test/libsolidity/SemVerMatcher.cpp @@ -171,6 +171,8 @@ BOOST_AUTO_TEST_CASE(negative_range) { // Negative range tests vector> tests = { + {"^0^1", "0.0.0"}, + {"^0^1", "1.0.0"}, {"1.0.0 - 2.0.0", "2.2.3"}, {"1.0", "1.0.0-pre"}, {"1", "1.0.0-pre"}, diff --git a/test/libsolidity/syntaxTests/pragma/broken_version_6.sol b/test/libsolidity/syntaxTests/pragma/broken_version_6.sol new file mode 100644 index 000000000..ab98e4f2a --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/broken_version_6.sol @@ -0,0 +1,3 @@ +pragma solidity v1.2.3; +// ---- +// ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. diff --git a/test/libsolidity/syntaxTests/pragma/broken_version_7.sol b/test/libsolidity/syntaxTests/pragma/broken_version_7.sol new file mode 100644 index 000000000..b4b6fea7a --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/broken_version_7.sol @@ -0,0 +1,3 @@ +pragma solidity >0.5.0<; +// ---- +// ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. diff --git a/test/libsolidity/syntaxTests/pragma/version_range.sol b/test/libsolidity/syntaxTests/pragma/version_range.sol new file mode 100644 index 000000000..4d6cdf6b9 --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/version_range.sol @@ -0,0 +1,2 @@ +pragma solidity >=0.4.0 <0.9.0; +// ----