diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-16 02:07:33 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-24 00:38:41 +0800 |
commit | ab3db782ae9193839a354a626a7d8ee7bdfad63a (patch) | |
tree | 9104bfcbb2418fd3c96186aba96909eff1915ef6 /test | |
parent | a7c2509adfe57f106cb87ed024925751732b5412 (diff) | |
download | dexon-solidity-ab3db782ae9193839a354a626a7d8ee7bdfad63a.tar.gz dexon-solidity-ab3db782ae9193839a354a626a7d8ee7bdfad63a.tar.zst dexon-solidity-ab3db782ae9193839a354a626a7d8ee7bdfad63a.zip |
test: check the error texts
by changing parseAnalyseAndReturnError to return the whole Error, not just the type
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 376 |
1 files changed, 188 insertions, 188 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index b0e0bbb4..6932f852 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -44,7 +44,7 @@ namespace test namespace { -pair<ASTPointer<SourceUnit>, std::shared_ptr<Error::Type const>> +pair<ASTPointer<SourceUnit>, std::shared_ptr<Error const>> parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false, bool _insertVersionPragma = true) { // Silence compiler version warning @@ -61,7 +61,7 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false, SyntaxChecker syntaxChecker(errors); if (!syntaxChecker.checkSyntax(*sourceUnit)) - return make_pair(sourceUnit, std::make_shared<Error::Type const>(errors[0]->type())); + return make_pair(sourceUnit, errors[0]); std::shared_ptr<GlobalContext> globalContext = make_shared<GlobalContext>(); NameAndTypeResolver resolver(globalContext->declarations(), errors); @@ -96,7 +96,7 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false, (_reportWarnings && currentError->type() == Error::Type::Warning) || (!_reportWarnings && currentError->type() != Error::Type::Warning) ) - return make_pair(sourceUnit, std::make_shared<Error::Type const>(currentError->type())); + return make_pair(sourceUnit, currentError); } } catch (InternalCompilerError const& _e) @@ -108,7 +108,7 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false, } catch (Error const& _e) { - return make_pair(sourceUnit, std::make_shared<Error::Type const>(_e.type())); + return make_pair(sourceUnit, std::make_shared<Error const>(_e)); } catch (...) { @@ -130,7 +130,7 @@ bool success(string const& _source) return !parseAnalyseAndReturnError(_source).second; } -Error::Type expectError(std::string const& _source, bool _warning = false) +Error expectError(std::string const& _source, bool _warning = false) { auto sourceAndError = parseAnalyseAndReturnError(_source, _warning); BOOST_REQUIRE(!!sourceAndError.second); @@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(double_stateVariable_declaration) " uint256 variable;\n" " uint128 variable;\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(double_function_declaration) @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE(double_function_declaration) " function fun() { uint x; }\n" " function fun() { uint x; }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(double_variable_declaration) @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(double_variable_declaration) char const* text = "contract test {\n" " function f() { uint256 x; if (true) { uint256 x; } }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(name_shadowing) @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE(undeclared_name) " uint256 variable;\n" " function f(uint256 arg) { f(notfound); }" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(reference_to_later_declaration) @@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_directly_recursive) " MyStructName x;\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive) @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive) " MyStructName1 x;\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_definition_not_really_recursive) @@ -303,7 +303,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return_wrong_number) char const* text = "contract test {\n" " function f() returns (bool r1, bool r2) { return 1 >= 2; }" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_checking_return_wrong_type) @@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return_wrong_type) char const* text = "contract test {\n" " function f() returns (uint256 r) { return 1 >= 2; }" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_checking_function_call) @@ -336,7 +336,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) char const* text = "contract test {\n" " function f() { int32(2) == uint64(2); }" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) @@ -372,7 +372,7 @@ BOOST_AUTO_TEST_CASE(balance_invalid) " address(0).balance = 7;\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_to_mapping) @@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(assignment_to_mapping) " data.map = a;\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_to_struct) @@ -411,7 +411,7 @@ BOOST_AUTO_TEST_CASE(returns_in_constructor) " function test() returns (uint a) {\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(forward_function_reference) @@ -499,7 +499,7 @@ BOOST_AUTO_TEST_CASE(create_abstract_contract) function foo() { b = new base();} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_optional) @@ -543,7 +543,7 @@ BOOST_AUTO_TEST_CASE(redeclare_implemented_abstract_function_as_abstract) contract derived is base { function foo() {} } contract wrong is derived { function foo(); } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(implement_abstract_via_constructor) @@ -667,7 +667,7 @@ BOOST_AUTO_TEST_CASE(function_external_call_not_allowed_conversion) } function g (C c) external {} })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_internal_allowed_conversion) @@ -699,7 +699,7 @@ BOOST_AUTO_TEST_CASE(function_internal_not_allowed_conversion) g(a); } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(hash_collision_in_interface) @@ -710,7 +710,7 @@ BOOST_AUTO_TEST_CASE(hash_collision_in_interface) " function tgeo() {\n" " }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(inheritance_basic) @@ -744,7 +744,7 @@ BOOST_AUTO_TEST_CASE(cyclic_inheritance) contract A is B { } contract B is A { } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(legal_override_direct) @@ -772,7 +772,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_visibility) contract B { function f() internal {} } contract C is B { function f() public {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(illegal_override_constness) @@ -781,7 +781,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_constness) contract B { function f() constant {} } contract C is B { function f() {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(complex_inheritance) @@ -851,7 +851,7 @@ BOOST_AUTO_TEST_CASE(implicit_base_to_derived_conversion) function f() { B b = A(1); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(super_excludes_current_contract) @@ -868,7 +868,7 @@ BOOST_AUTO_TEST_CASE(super_excludes_current_contract) } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_modifier_invocation) @@ -891,7 +891,7 @@ BOOST_AUTO_TEST_CASE(invalid_function_modifier_type) modifier mod1(uint a) { if (a > 0) _; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_modifier_invocation_parameters) @@ -932,7 +932,7 @@ BOOST_AUTO_TEST_CASE(illegal_modifier_override) contract A { modifier mod(uint a) { _; } } contract B is A { modifier mod(uint8 a) { _; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(modifier_overrides_function) @@ -941,7 +941,7 @@ BOOST_AUTO_TEST_CASE(modifier_overrides_function) contract A { modifier mod(uint a) { _; } } contract B is A { function mod(uint a) { } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_overrides_modifier) @@ -950,7 +950,7 @@ BOOST_AUTO_TEST_CASE(function_overrides_modifier) contract A { function mod(uint a) { } } contract B is A { modifier mod(uint a) { _; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(modifier_returns_value) @@ -961,7 +961,7 @@ BOOST_AUTO_TEST_CASE(modifier_returns_value) modifier mod(uint a) { _; return 7; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(state_variable_accessors) @@ -1012,7 +1012,7 @@ BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor) "uint256 foo;\n" " function foo() {}\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(private_state_variable) @@ -1045,7 +1045,7 @@ BOOST_AUTO_TEST_CASE(missing_state_variable) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } @@ -1069,7 +1069,7 @@ BOOST_AUTO_TEST_CASE(struct_accessor_one_array_only) Data public data; } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) @@ -1094,7 +1094,7 @@ BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class1) "contract Child is Parent2{\n" " function foo() returns (uint256) { return Parent2.m_aMember1; }\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class2) @@ -1109,7 +1109,7 @@ BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class2) " function foo() returns (uint256) { return Child.m_aMember2; }\n" " uint256 public m_aMember3;\n" "}\n"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function) @@ -1131,7 +1131,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_arguments) function(uint a) { x = 2; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function_in_library) @@ -1141,7 +1141,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_in_library) function() {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters) @@ -1151,7 +1151,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters) function() returns (uint) { } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function_with_constant_modifier) @@ -1162,7 +1162,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_constant_modifier) function() constant { x = 2; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function_twice) @@ -1174,7 +1174,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_twice) function() { x = 3; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(fallback_function_inheritance) @@ -1207,7 +1207,7 @@ BOOST_AUTO_TEST_CASE(event_too_many_indexed) contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d); })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(anonymous_event_four_indexed) @@ -1225,7 +1225,7 @@ BOOST_AUTO_TEST_CASE(anonymous_event_too_many_indexed) contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(event_call) @@ -1281,7 +1281,7 @@ BOOST_AUTO_TEST_CASE(access_to_internal_function) contract d { function g() { c(0).f(); } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(access_to_default_state_variable_visibility) @@ -1293,7 +1293,7 @@ BOOST_AUTO_TEST_CASE(access_to_default_state_variable_visibility) contract d { function g() { c(0).a(); } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(access_to_internal_state_variable) @@ -1314,7 +1314,7 @@ BOOST_AUTO_TEST_CASE(error_count_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1}); }\n" "}\n"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(empty_in_named_args) @@ -1323,7 +1323,7 @@ BOOST_AUTO_TEST_CASE(empty_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({}); }\n" "}\n"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(duplicate_parameter_names_in_named_args) @@ -1332,7 +1332,7 @@ BOOST_AUTO_TEST_CASE(duplicate_parameter_names_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1, a: 2}); }\n" "}\n"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_parameter_names_in_named_args) @@ -1341,7 +1341,7 @@ BOOST_AUTO_TEST_CASE(invalid_parameter_names_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1, c: 2}); }\n" "}\n"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(empty_name_input_parameter) @@ -1383,13 +1383,13 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter_with_named_one) return 5; } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(disallow_declaration_of_void_type) { char const* sourceCode = "contract c { function f() { var (x) = f(); } }"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) @@ -1412,7 +1412,7 @@ BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) } uint256 a; })"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big) @@ -1421,7 +1421,7 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big) contract test { function f() returns(uint d) { return 2 ** 10000000000; } })"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_member_access) @@ -1466,7 +1466,7 @@ BOOST_AUTO_TEST_CASE(enum_invalid_member_access) ActionChoices choices; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_invalid_direct_member_access) @@ -1481,7 +1481,7 @@ BOOST_AUTO_TEST_CASE(enum_invalid_direct_member_access) ActionChoices choices; } )"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay) @@ -1532,7 +1532,7 @@ BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay) uint64 b; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_to_enum_conversion_is_not_okay) @@ -1547,7 +1547,7 @@ BOOST_AUTO_TEST_CASE(enum_to_enum_conversion_is_not_okay) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_duplicate_values) @@ -1557,7 +1557,7 @@ BOOST_AUTO_TEST_CASE(enum_duplicate_values) enum ActionChoices { GoLeft, GoRight, GoLeft, Sit } } )"; - BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(enum_name_resolution_under_current_contract_name) @@ -1587,7 +1587,7 @@ BOOST_AUTO_TEST_CASE(private_visibility) function g() { f(); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(private_visibility_via_explicit_base_access) @@ -1600,7 +1600,7 @@ BOOST_AUTO_TEST_CASE(private_visibility_via_explicit_base_access) function g() { base.f(); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_visibility) @@ -1611,7 +1611,7 @@ BOOST_AUTO_TEST_CASE(external_visibility) function g() { f(); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(external_base_visibility) @@ -1624,7 +1624,7 @@ BOOST_AUTO_TEST_CASE(external_base_visibility) function g() { base.f(); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_assign) @@ -1634,7 +1634,7 @@ BOOST_AUTO_TEST_CASE(external_argument_assign) function f(uint a) external { a = 1; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_increment) @@ -1644,7 +1644,7 @@ BOOST_AUTO_TEST_CASE(external_argument_increment) function f(uint a) external { a++; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_delete) @@ -1654,7 +1654,7 @@ BOOST_AUTO_TEST_CASE(external_argument_delete) function f(uint a) external { delete a; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(test_for_bug_override_function_with_bytearray_type) @@ -1676,7 +1676,7 @@ BOOST_AUTO_TEST_CASE(array_with_nonconstant_length) contract c { function f(uint a) { uint8[a] x; } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types1) @@ -1687,7 +1687,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types1) uint[] b; function f() { b = a; } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types2) @@ -1698,7 +1698,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types2) uint8[] b; function f() { b = a; } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_conversion_possible) @@ -1731,7 +1731,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) uint[80] b; function f() { b = a; } })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) @@ -1740,7 +1740,7 @@ BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) contract c { uint8 a = 1000; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string) @@ -1749,7 +1749,7 @@ BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string) contract c { uint a = "abc"; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(test_fromElementaryTypeName) @@ -1875,7 +1875,7 @@ BOOST_AUTO_TEST_CASE(assigning_value_to_const_variable) function changeIt() { x = 9; } uint constant x = 56; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(complex_const_variable) @@ -1885,7 +1885,7 @@ BOOST_AUTO_TEST_CASE(complex_const_variable) contract Foo { mapping(uint => bool) constant mapVar; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(uninitialized_const_variable) @@ -1894,7 +1894,7 @@ BOOST_AUTO_TEST_CASE(uninitialized_const_variable) contract Foo { uint constant y; })"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve) @@ -1906,7 +1906,7 @@ BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve) function g() returns(uint) { return f(3, 5); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(ambiguous_overloaded_function) @@ -1919,7 +1919,7 @@ BOOST_AUTO_TEST_CASE(ambiguous_overloaded_function) function g() returns(uint) { return f(1); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_of_nonoverloaded_function) @@ -1942,7 +1942,7 @@ BOOST_AUTO_TEST_CASE(assignment_of_overloaded_function) function g() returns(uint) { var x = f; return x(7); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_types_clash) @@ -1956,7 +1956,7 @@ BOOST_AUTO_TEST_CASE(external_types_clash) function f(uint8 a) { } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(override_changes_return_types) @@ -1969,7 +1969,7 @@ BOOST_AUTO_TEST_CASE(override_changes_return_types) function f(uint a) returns (uint8) { } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multiple_constructors) @@ -1980,7 +1980,7 @@ BOOST_AUTO_TEST_CASE(multiple_constructors) function test() {} } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(equal_overload) @@ -1991,7 +1991,7 @@ BOOST_AUTO_TEST_CASE(equal_overload) function test(uint a) external {} } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(uninitialized_var) @@ -2001,7 +2001,7 @@ BOOST_AUTO_TEST_CASE(uninitialized_var) function f() returns (uint) { var x; return 2; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string) @@ -2023,7 +2023,7 @@ BOOST_AUTO_TEST_CASE(string_index) function f() { var a = s[2]; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string_length) @@ -2034,7 +2034,7 @@ BOOST_AUTO_TEST_CASE(string_length) function f() { var a = s.length; } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(negative_integers_to_signed_out_of_bound) @@ -2044,7 +2044,7 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_signed_out_of_bound) int8 public i = -129; } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(negative_integers_to_signed_min) @@ -2064,7 +2064,7 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound) int8 public j = 128; } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound_max) @@ -2084,7 +2084,7 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_unsigned) uint8 public x = -1; } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound) @@ -2094,7 +2094,7 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound) uint8 public x = 700; } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(integer_boolean_operators) @@ -2102,15 +2102,15 @@ BOOST_AUTO_TEST_CASE(integer_boolean_operators) char const* sourceCode1 = R"( contract test { function() { uint x = 1; uint y = 2; x || y; } } )"; - BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode1).type() == Error::Type::TypeError); char const* sourceCode2 = R"( contract test { function() { uint x = 1; uint y = 2; x && y; } } )"; - BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode2).type() == Error::Type::TypeError); char const* sourceCode3 = R"( contract test { function() { uint x = 1; !x; } } )"; - BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode3).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(exp_signed_variable) @@ -2118,15 +2118,15 @@ BOOST_AUTO_TEST_CASE(exp_signed_variable) char const* sourceCode1 = R"( contract test { function() { uint x = 3; int y = -4; x ** y; } } )"; - BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode1).type() == Error::Type::TypeError); char const* sourceCode2 = R"( contract test { function() { uint x = 3; int y = -4; y ** x; } } )"; - BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode2).type() == Error::Type::TypeError); char const* sourceCode3 = R"( contract test { function() { int x = -3; int y = -4; x ** y; } } )"; - BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode3).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(reference_compare_operators) @@ -2134,11 +2134,11 @@ BOOST_AUTO_TEST_CASE(reference_compare_operators) char const* sourceCode1 = R"( contract test { bytes a; bytes b; function() { a == b; } } )"; - BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode1).type() == Error::Type::TypeError); char const* sourceCode2 = R"( contract test { struct s {uint a;} s x; s y; function() { x == y; } } )"; - BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode2).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overwrite_memory_location_external) @@ -2148,7 +2148,7 @@ BOOST_AUTO_TEST_CASE(overwrite_memory_location_external) function f(uint[] memory a) external {} } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overwrite_storage_location_external) @@ -2158,7 +2158,7 @@ BOOST_AUTO_TEST_CASE(overwrite_storage_location_external) function f(uint[] storage a) external {} } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_location_local_variables) @@ -2184,7 +2184,7 @@ BOOST_AUTO_TEST_CASE(no_mappings_in_memory_array) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) @@ -2198,7 +2198,7 @@ BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) @@ -2215,7 +2215,7 @@ BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(no_delete_on_storage_pointers) @@ -2229,7 +2229,7 @@ BOOST_AUTO_TEST_CASE(no_delete_on_storage_pointers) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_mem_storage_variable_directly) @@ -2256,7 +2256,7 @@ BOOST_AUTO_TEST_CASE(function_argument_mem_to_storage) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_argument_storage_to_mem) @@ -2285,7 +2285,7 @@ BOOST_AUTO_TEST_CASE(mem_array_assignment_changes_base_type) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible) @@ -2300,7 +2300,7 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(memory_arrays_not_resizeable) @@ -2313,7 +2313,7 @@ BOOST_AUTO_TEST_CASE(memory_arrays_not_resizeable) } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_constructor) @@ -2379,7 +2379,7 @@ BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(memory_structs_with_mappings) @@ -2394,7 +2394,7 @@ BOOST_AUTO_TEST_CASE(memory_structs_with_mappings) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string_bytes_conversion) @@ -2420,7 +2420,7 @@ BOOST_AUTO_TEST_CASE(inheriting_from_library) library Lib {} contract Test is Lib {} )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(inheriting_library) @@ -2429,7 +2429,7 @@ BOOST_AUTO_TEST_CASE(inheriting_library) contract Test {} library Lib is Test {} )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(library_having_variables) @@ -2437,7 +2437,7 @@ BOOST_AUTO_TEST_CASE(library_having_variables) char const* text = R"( library Lib { uint x; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(valid_library) @@ -2470,7 +2470,7 @@ BOOST_AUTO_TEST_CASE(creating_contract_within_the_contract) function f() { var x = new Test(); } } )"; - BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_out_of_bound_access) @@ -2484,7 +2484,7 @@ BOOST_AUTO_TEST_CASE(array_out_of_bound_access) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(literal_string_to_storage_pointer) @@ -2494,7 +2494,7 @@ BOOST_AUTO_TEST_CASE(literal_string_to_storage_pointer) function f() { string x = "abc"; } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(non_initialized_references) @@ -2513,7 +2513,7 @@ BOOST_AUTO_TEST_CASE(non_initialized_references) } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Uninitialized storage pointer")); } BOOST_AUTO_TEST_CASE(sha3_with_large_integer_constant) @@ -2524,7 +2524,7 @@ BOOST_AUTO_TEST_CASE(sha3_with_large_integer_constant) function f() { sha3(2**500); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(cyclic_binary_dependency) @@ -2534,7 +2534,7 @@ BOOST_AUTO_TEST_CASE(cyclic_binary_dependency) contract B { function f() { new C(); } } contract C { function f() { new A(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(cyclic_binary_dependency_via_inheritance) @@ -2544,7 +2544,7 @@ BOOST_AUTO_TEST_CASE(cyclic_binary_dependency_via_inheritance) contract B { function f() { new C(); } } contract C { function f() { new A(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_fail) @@ -2552,7 +2552,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_fail) char const* text = R"( contract C { function f() { var (x,y); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fine) @@ -2583,7 +2583,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_1) function f() { var (a, b, ) = one(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_2) { @@ -2593,7 +2593,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_2) function f() { var (a, , ) = one(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_3) @@ -2604,7 +2604,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_3) function f() { var (, , a) = one(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_4) @@ -2615,7 +2615,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_4) function f() { var (, a, b) = one(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(tuples) @@ -2642,7 +2642,7 @@ BOOST_AUTO_TEST_CASE(tuples_empty_components) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_5) @@ -2653,7 +2653,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_5) function f() { var (,) = one(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6) @@ -2664,7 +2664,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6) function f() { var (a, b, c) = two(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity) @@ -2707,7 +2707,7 @@ BOOST_AUTO_TEST_CASE(using_for_not_library) using D for uint; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(using_for_function_exists) @@ -2798,7 +2798,7 @@ BOOST_AUTO_TEST_CASE(using_for_mismatch) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(using_for_not_used) @@ -2814,7 +2814,7 @@ BOOST_AUTO_TEST_CASE(using_for_not_used) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(library_memory_struct) @@ -2825,7 +2825,7 @@ BOOST_AUTO_TEST_CASE(library_memory_struct) function f() returns (S ) {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(using_for_arbitrary_mismatch) @@ -2840,7 +2840,7 @@ BOOST_AUTO_TEST_CASE(using_for_arbitrary_mismatch) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(bound_function_in_var) @@ -2886,7 +2886,7 @@ BOOST_AUTO_TEST_CASE(mapping_in_memory_array) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(new_for_non_array) @@ -2898,7 +2898,7 @@ BOOST_AUTO_TEST_CASE(new_for_non_array) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_args_creating_memory_array) @@ -2910,7 +2910,7 @@ BOOST_AUTO_TEST_CASE(invalid_args_creating_memory_array) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_overload_array_type) @@ -3030,7 +3030,7 @@ BOOST_AUTO_TEST_CASE(invalid_types_in_inline_array) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(dynamic_inline_array) @@ -3055,7 +3055,7 @@ BOOST_AUTO_TEST_CASE(lvalues_as_inline_array) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(break_not_in_loop) @@ -3068,7 +3068,7 @@ BOOST_AUTO_TEST_CASE(break_not_in_loop) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::SyntaxError); + BOOST_CHECK(expectError(text).type() == Error::Type::SyntaxError); } BOOST_AUTO_TEST_CASE(continue_not_in_loop) @@ -3081,7 +3081,7 @@ BOOST_AUTO_TEST_CASE(continue_not_in_loop) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::SyntaxError); + BOOST_CHECK(expectError(text).type() == Error::Type::SyntaxError); } BOOST_AUTO_TEST_CASE(continue_not_in_loop_2) @@ -3096,7 +3096,7 @@ BOOST_AUTO_TEST_CASE(continue_not_in_loop_2) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::SyntaxError); + BOOST_CHECK(expectError(text).type() == Error::Type::SyntaxError); } BOOST_AUTO_TEST_CASE(invalid_different_types_for_conditional_expression) @@ -3108,7 +3108,7 @@ BOOST_AUTO_TEST_CASE(invalid_different_types_for_conditional_expression) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(left_value_in_conditional_expression_not_supported_yet) @@ -3122,7 +3122,7 @@ BOOST_AUTO_TEST_CASE(left_value_in_conditional_expression_not_supported_yet) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(conditional_expression_with_different_struct) @@ -3142,7 +3142,7 @@ BOOST_AUTO_TEST_CASE(conditional_expression_with_different_struct) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(conditional_expression_with_different_function_type) @@ -3157,7 +3157,7 @@ BOOST_AUTO_TEST_CASE(conditional_expression_with_different_function_type) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(conditional_expression_with_different_enum) @@ -3175,7 +3175,7 @@ BOOST_AUTO_TEST_CASE(conditional_expression_with_different_enum) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(conditional_expression_with_different_mapping) @@ -3190,7 +3190,7 @@ BOOST_AUTO_TEST_CASE(conditional_expression_with_different_mapping) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(conditional_with_all_types) @@ -3287,7 +3287,7 @@ BOOST_AUTO_TEST_CASE(constructor_call_invalid_arg_count) } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(index_access_for_bytes) @@ -3909,7 +3909,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_send) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Return value of low-level calls not used")); } BOOST_AUTO_TEST_CASE(unused_return_value_call) @@ -3921,7 +3921,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_call) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Return value of low-level calls not used")); } BOOST_AUTO_TEST_CASE(unused_return_value_call_value) @@ -3933,7 +3933,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_call_value) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Return value of low-level calls not used")); } BOOST_AUTO_TEST_CASE(unused_return_value_callcode) @@ -3945,7 +3945,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_callcode) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Return value of low-level calls not used")); } BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall) @@ -3957,7 +3957,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Return value of low-level calls not used")); } BOOST_AUTO_TEST_CASE(modifier_without_underscore) @@ -3967,7 +3967,7 @@ BOOST_AUTO_TEST_CASE(modifier_without_underscore) modifier m() {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::SyntaxError); + BOOST_CHECK(expectError(text).type() == Error::Type::SyntaxError); } BOOST_AUTO_TEST_CASE(payable_in_library) @@ -3977,7 +3977,7 @@ BOOST_AUTO_TEST_CASE(payable_in_library) function f() payable {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(payable_external) @@ -3997,7 +3997,7 @@ BOOST_AUTO_TEST_CASE(payable_internal) function f() payable internal {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(payable_private) @@ -4007,7 +4007,7 @@ BOOST_AUTO_TEST_CASE(payable_private) function f() payable private {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(illegal_override_payable) @@ -4016,7 +4016,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_payable) contract B { function f() payable {} } contract C is B { function f() {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(illegal_override_payable_nonpayable) @@ -4025,7 +4025,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_payable_nonpayable) contract B { function f() {} } contract C is B { function f() payable {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(payable_constant_conflict) @@ -4033,7 +4033,7 @@ BOOST_AUTO_TEST_CASE(payable_constant_conflict) char const* text = R"( contract C { function f() payable constant {} } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(calling_payable) @@ -4057,7 +4057,7 @@ BOOST_AUTO_TEST_CASE(calling_nonpayable) function f() { (new receiver()).nopay.value(10)(); } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(non_payable_constructor) @@ -4073,7 +4073,7 @@ BOOST_AUTO_TEST_CASE(non_payable_constructor) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(warn_nonpresent_pragma) @@ -4082,7 +4082,7 @@ BOOST_AUTO_TEST_CASE(warn_nonpresent_pragma) auto sourceAndError = parseAnalyseAndReturnError(text, true, false); BOOST_REQUIRE(!!sourceAndError.second); BOOST_REQUIRE(!!sourceAndError.first); - BOOST_CHECK(*sourceAndError.second == Error::Type::Warning); + BOOST_CHECK(sourceAndError.second->regex_search("Source file does not specify required compiler version!")); } BOOST_AUTO_TEST_CASE(unsatisfied_version) @@ -4090,7 +4090,7 @@ BOOST_AUTO_TEST_CASE(unsatisfied_version) char const* text = R"( pragma solidity ^99.99.0; )"; - BOOST_CHECK(expectError(text, true) == Error::Type::SyntaxError); + BOOST_CHECK(expectError(text, true).type() == Error::Type::SyntaxError); } BOOST_AUTO_TEST_CASE(constant_constructor) @@ -4100,7 +4100,7 @@ BOOST_AUTO_TEST_CASE(constant_constructor) function test() constant {} } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_constructor) @@ -4110,7 +4110,7 @@ BOOST_AUTO_TEST_CASE(external_constructor) function test() external {} } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_array_as_statement) @@ -4121,7 +4121,7 @@ BOOST_AUTO_TEST_CASE(invalid_array_as_statement) function test(uint k) { S[k]; } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(using_directive_for_missing_selftype) @@ -4140,7 +4140,7 @@ BOOST_AUTO_TEST_CASE(using_directive_for_missing_selftype) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_type) @@ -4188,7 +4188,7 @@ BOOST_AUTO_TEST_CASE(private_function_type) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(public_function_type) @@ -4200,7 +4200,7 @@ BOOST_AUTO_TEST_CASE(public_function_type) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(payable_internal_function_type) @@ -4210,7 +4210,7 @@ BOOST_AUTO_TEST_CASE(payable_internal_function_type) function (uint) internal payable returns (uint) x; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(call_value_on_non_payable_function_type) @@ -4223,7 +4223,7 @@ BOOST_AUTO_TEST_CASE(call_value_on_non_payable_function_type) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_function_type_returning_internal) @@ -4233,7 +4233,7 @@ BOOST_AUTO_TEST_CASE(external_function_type_returning_internal) function() external returns (function () internal) x; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_function_type_taking_internal) @@ -4243,7 +4243,7 @@ BOOST_AUTO_TEST_CASE(external_function_type_taking_internal) function(function () internal) external x; } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(call_value_on_payable_function_type) @@ -4269,7 +4269,7 @@ BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(internal_function_returned_from_public_function) @@ -4281,7 +4281,7 @@ BOOST_AUTO_TEST_CASE(internal_function_returned_from_public_function) } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter_in_library_internal) @@ -4303,7 +4303,7 @@ BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter_in_library_external } } )"; - BOOST_CHECK(expectError(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_type_arrays) @@ -4353,7 +4353,7 @@ BOOST_AUTO_TEST_CASE(delete_function_type_invalid) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(delete_external_function_type_invalid) @@ -4365,7 +4365,7 @@ BOOST_AUTO_TEST_CASE(delete_external_function_type_invalid) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_fixed_point_literal) @@ -4377,7 +4377,7 @@ BOOST_AUTO_TEST_CASE(invalid_fixed_point_literal) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(shift_constant_left_negative_rvalue) @@ -4387,7 +4387,7 @@ BOOST_AUTO_TEST_CASE(shift_constant_left_negative_rvalue) uint public a = 0x42 << -8; } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(shift_constant_right_negative_rvalue) @@ -4397,7 +4397,7 @@ BOOST_AUTO_TEST_CASE(shift_constant_right_negative_rvalue) uint public a = 0x42 >> -8; } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(shift_constant_left_excessive_rvalue) @@ -4407,7 +4407,7 @@ BOOST_AUTO_TEST_CASE(shift_constant_left_excessive_rvalue) uint public a = 0x42 << 0x100000000; } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(shift_constant_right_excessive_rvalue) @@ -4417,7 +4417,7 @@ BOOST_AUTO_TEST_CASE(shift_constant_right_excessive_rvalue) uint public a = 0x42 >> 0x100000000; } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_positive_stack) @@ -4431,7 +4431,7 @@ BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_positive_stack) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Inline assembly block is not balanced")); } BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_negative_stack) @@ -4445,7 +4445,7 @@ BOOST_AUTO_TEST_CASE(inline_assembly_unbalanced_negative_stack) } } )"; - BOOST_CHECK(expectError(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true).regex_search("Inline assembly block is not balanced")); } BOOST_AUTO_TEST_CASE(inline_assembly_in_modifier) @@ -4478,7 +4478,7 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(inline_assembly_storage_in_modifiers) @@ -4496,7 +4496,7 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_in_modifiers) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(invalid_mobile_type) @@ -4509,7 +4509,7 @@ BOOST_AUTO_TEST_CASE(invalid_mobile_type) } } )"; - BOOST_CHECK(expectError(text, false) == Error::Type::TypeError); + BOOST_CHECK(expectError(text, false).type() == Error::Type::TypeError); } BOOST_AUTO_TEST_SUITE_END() |