aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-08 21:41:46 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-10 07:15:25 +0800
commit470950e75e6f3a8a37d2a8fe1c263149be01c402 (patch)
tree621b28106534a3eb7d686332eafcc59827f16464 /test/libsolidity
parent57c24511308f9cd1f981e92aacfb880825eb6ed9 (diff)
downloaddexon-solidity-470950e75e6f3a8a37d2a8fe1c263149be01c402.tar.gz
dexon-solidity-470950e75e6f3a8a37d2a8fe1c263149be01c402.tar.zst
dexon-solidity-470950e75e6f3a8a37d2a8fe1c263149be01c402.zip
Add tests for experimental pragma
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 2fbc6ac8..55ce5f7b 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6558,6 +6558,43 @@ BOOST_AUTO_TEST_CASE(library_function_without_implementation)
CHECK_ERROR(text, TypeError, "Internal library function must be implemented if declared.");
}
+BOOST_AUTO_TEST_CASE(experimental_pragma)
+{
+ char const* text = R"(
+ pragma experimental;
+ )";
+ CHECK_ERROR(text, SyntaxError, "Experimental feature name is missing.");
+ text = R"(
+ pragma experimental 123;
+ )";
+ CHECK_ERROR(text, SyntaxError, "Unsupported experimental feature name.");
+ text = R"(
+ pragma experimental unsupportedName;
+ )";
+ CHECK_ERROR(text, SyntaxError, "Unsupported experimental feature name.");
+ text = R"(
+ pragma experimental "unsupportedName";
+ )";
+ CHECK_ERROR(text, SyntaxError, "Unsupported experimental feature name.");
+ text = R"(
+ pragma experimental "";
+ )";
+ CHECK_ERROR(text, SyntaxError, "Empty experimental feature name is invalid.");
+ text = R"(
+ pragma experimental unsupportedName unsupportedName;
+ )";
+ CHECK_ERROR(text, SyntaxError, "Stray arguments.");
+// text = R"(
+// pragma experimental supportedName;
+// )";
+// CHECK_WARNING(text, "Experimental features are turned on. Do not use experimental features on live deployments.");
+// text = R"(
+// pragma experimental supportedName;
+// pragma experimental supportedName;
+// )";
+// CHECK_ERROR(text, SyntaxError, "Duplicate experimental feature name.");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}