aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-21 16:18:51 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-24 21:28:23 +0800
commitdf900c558396ed4a33905eea730964a4ecc087ea (patch)
tree7184cd2c227fd8918afbadc3cb29240a93465c03
parent2f1310124308cba97e5b14c3f4a089a435320582 (diff)
downloaddexon-solidity-df900c558396ed4a33905eea730964a4ecc087ea.tar.gz
dexon-solidity-df900c558396ed4a33905eea730964a4ecc087ea.tar.zst
dexon-solidity-df900c558396ed4a33905eea730964a4ecc087ea.zip
test: add a test about using an inherited enum definition as an expression,
with an explicit mention of the base contract. The test is about #1131.
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 16002f9a..bb197cca 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5905,6 +5905,48 @@ BOOST_AUTO_TEST_CASE(using_library_structs)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7), u256(8)));
}
+BOOST_AUTO_TEST_CASE(library_struct_as_an_expression)
+{
+ char const* sourceCode = R"(
+ library Arst {
+ struct Foo {
+ int Things;
+ int Stuff;
+ }
+ }
+
+ contract Tsra {
+ function f() returns(uint) {
+ Arst.Foo;
+ return 1;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "Tsra");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
+}
+
+BOOST_AUTO_TEST_CASE(library_enum_as_an_expression)
+{
+ char const* sourceCode = R"(
+ library Arst {
+ enum Foo {
+ Things,
+ Stuff
+ }
+ }
+
+ contract Tsra {
+ function f() returns(uint) {
+ Arst.Foo;
+ return 1;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "Tsra");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
+}
+
BOOST_AUTO_TEST_CASE(short_strings)
{
// This test verifies that the byte array encoding that combines length and data works