aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-12 01:24:38 +0800
committerchriseth <chris@ethereum.org>2017-04-25 22:49:03 +0800
commit34717838da875c5265f005bb92c3349c08063ba5 (patch)
tree4fbd69879a891dd5ff13c79ffb71f26e6e9bc8aa /test
parent83bf34c571023cb264c56b3bd791a6fd9ebc3bf2 (diff)
downloaddexon-solidity-34717838da875c5265f005bb92c3349c08063ba5.tar.gz
dexon-solidity-34717838da875c5265f005bb92c3349c08063ba5.tar.zst
dexon-solidity-34717838da875c5265f005bb92c3349c08063ba5.zip
Review comments.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/InlineAssembly.cpp5
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp30
2 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index 42aa66a0..bf966510 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -342,6 +342,11 @@ BOOST_AUTO_TEST_CASE(magic_variables)
BOOST_CHECK(successAssemble("{ let ecrecover := 1 ecrecover pop }"));
}
+BOOST_AUTO_TEST_CASE(stack_variables)
+{
+ BOOST_CHECK(successAssemble("{ let y := 3 { 2 { let x := y } pop} }"));
+}
+
BOOST_AUTO_TEST_CASE(imbalanced_stack)
{
BOOST_CHECK(successAssemble("{ 1 2 mul pop }", false));
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 3b0804f8..73698a8d 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5078,6 +5078,36 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_in_modifiers)
CHECK_ERROR(text, DeclarationError, "Variable not found or variable not lvalue.");
}
+BOOST_AUTO_TEST_CASE(inline_assembly_constant_assign)
+{
+ char const* text = R"(
+ contract test {
+ uint constant x = 1;
+ function f() {
+ assembly {
+ x := 2
+ }
+ }
+ }
+ )";
+ CHECK_ERROR(text, DeclarationError, "Variable not found or variable not lvalue.");
+}
+
+BOOST_AUTO_TEST_CASE(inline_assembly_constant_access)
+{
+ char const* text = R"(
+ contract test {
+ uint constant x = 1;
+ function f() {
+ assembly {
+ let y := x
+ }
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Constant variables not yet implemented for inline assembly");
+}
+
BOOST_AUTO_TEST_CASE(invalid_mobile_type)
{
char const* text = R"(