diff options
author | chriseth <chris@ethereum.org> | 2016-10-24 21:53:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 21:53:11 +0800 |
commit | d651a506fab547414250a04245148ac5be5d376f (patch) | |
tree | 4d98bf01b47b4393a5a207a91dbd187e4e1d354e /test | |
parent | 9e0594f4c1bf34a48771c7d67e6c76e1197425ae (diff) | |
parent | abf393126ba7e5da7871dc87276f36af6568f4fd (diff) | |
download | dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar.gz dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar.bz2 dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar.lz dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar.xz dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.tar.zst dexon-solidity-d651a506fab547414250a04245148ac5be5d376f.zip |
Merge pull request #1263 from ethereum/1116
Do not push code for `L` in `L.Foo`, an enum Foo defined in a library L
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 42 |
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 |