From a5d12b876180088904a026c472da23201a35d59c Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 9 Oct 2015 19:35:41 +0200 Subject: Introduced tuple type and added multi variable declarations to type checker. --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 4 ++-- test/libsolidity/SolidityParser.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'test') 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() } -- cgit v1.2.3