aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/ObjectParser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2019-01-22 20:49:41 +0800
committerGitHub <noreply@github.com>2019-01-22 20:49:41 +0800
commit10d17f245839f208ec5085309022a32cd2502f55 (patch)
treeb2c9f68980d0d418cd6f511e9f3f3f71369abe25 /test/libyul/ObjectParser.cpp
parent1df8f40cd2fd7b47698d847907b8ca7b47eb488d (diff)
parent0ecafe032a84cb6960545dd7f18733430c1f782d (diff)
downloaddexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.gz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.bz2
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.lz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.xz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.zst
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.zip
Merge pull request #5836 from ethereum/develop
Merge develop into release for 0.5.3.
Diffstat (limited to 'test/libyul/ObjectParser.cpp')
-rw-r--r--test/libyul/ObjectParser.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libyul/ObjectParser.cpp b/test/libyul/ObjectParser.cpp
index bb88e4da..13a95788 100644
--- a/test/libyul/ObjectParser.cpp
+++ b/test/libyul/ObjectParser.cpp
@@ -250,6 +250,36 @@ BOOST_AUTO_TEST_CASE(to_string)
BOOST_CHECK_EQUAL(asmStack.print(), expectation);
}
+BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_literal)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := "outer" let y := dataoffset(x) }
+ }
+ )";
+ CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
+}
+
+BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := "outer" let y := datasize(x) }
+ }
+ )";
+ CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
+}
+
+BOOST_AUTO_TEST_CASE(args_to_datacopy_are_arbitrary)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := 0 let y := 2 let s := 3 datacopy(x, y, s) }
+ }
+ )";
+ BOOST_CHECK(successParse(code));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}