diff options
author | chriseth <c@ethdev.com> | 2015-10-10 01:35:41 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-10 01:35:41 +0800 |
commit | a5d12b876180088904a026c472da23201a35d59c (patch) | |
tree | 277c5e2da4bc1ea04f10b3369f96c5f087fb01db /test | |
parent | c54a033bf036d16651fb992689adfcffb2f3a951 (diff) | |
download | dexon-solidity-a5d12b876180088904a026c472da23201a35d59c.tar.gz dexon-solidity-a5d12b876180088904a026c472da23201a35d59c.tar.zst dexon-solidity-a5d12b876180088904a026c472da23201a35d59c.zip |
Introduced tuple type and added multi variable declarations to type
checker.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 4 | ||||
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index c6d69f42..fc6d54a8 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1285,7 +1285,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter_with_named_one) BOOST_AUTO_TEST_CASE(disallow_declaration_of_void_type) { - char const* sourceCode = "contract c { function f() { var x = f(); } }"; + char const* sourceCode = "contract c { function f() { var (x) = f(); } }"; SOLIDITY_CHECK_ERROR_TYPE(parseAndAnalyseReturnError(sourceCode), TypeError); } @@ -2134,7 +2134,7 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible) contract C { function f(uint) returns (string); function g() { - var x = this.f(2); + var (x,) = this.f(2); } } )"; diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 569530b9..0e69bfa8 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -952,6 +952,18 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration) BOOST_CHECK_NO_THROW(parseText(text)); } +BOOST_AUTO_TEST_CASE(multi_variable_declaration_invalid) +{ + char const* text = R"( + library Lib { + function f() { + var () = g(); + } + } + )"; + BOOST_CHECK_THROW(parseText(text), ParserError); +} + BOOST_AUTO_TEST_SUITE_END() } |