From 6cb2770344ccc781911d48a645335733e850e0af Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 20 Oct 2016 01:15:39 +0100 Subject: [PATCH] Add two test cases for unbalanced inline assembly --- .../SolidityNameAndTypeResolution.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 7eedbefae..834723695 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() }