diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-10-21 04:55:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-21 04:55:45 +0800 |
commit | 5875890576eb95dd73bc04b5e864975cd7a55f43 (patch) | |
tree | 88845f6ad9ce185992a35841b70272161616c8be /test | |
parent | 008c4111d730becb1eeb53946b982e575e982c9b (diff) | |
parent | 6cb2770344ccc781911d48a645335733e850e0af (diff) | |
download | dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar.gz dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar.bz2 dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar.lz dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar.xz dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.tar.zst dexon-solidity-5875890576eb95dd73bc04b5e864975cd7a55f43.zip |
Merge pull request #1224 from ethereum/inline-assembly-stack-warning
Issue inline assembly stack warning if not balanced
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/InlineAssembly.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index f8655c0c..6c04367f 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -51,7 +51,7 @@ bool successParse(std::string const& _source, bool _assemble = false) if (_assemble) { stack.assemble(); - if (!stack.errors().empty()) + if (!stack.errors().empty() && !Error::containsOnlyWarnings(stack.errors())) return false; } } diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 7eedbefa..83472369 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4079,6 +4079,34 @@ BOOST_AUTO_TEST_CASE(shift_constant_right_excessive_rvalue) BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_positive_stack) +{ + char const* text = R"( + contract test { + function f() { + assembly { + 1 + } + } + } + )"; + BOOST_CHECK(expectError(text, true) == Error::Type::Warning); +} + +BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_negative_stack) +{ + char const* text = R"( + contract test { + function f() { + assembly { + pop + } + } + } + )"; + BOOST_CHECK(expectError(text, true) == Error::Type::Warning); +} + BOOST_AUTO_TEST_SUITE_END() } |