From 07e765a2f1105343ef495fafeb6faa6cf0fefd18 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 20:49:59 +0100 Subject: Move some parser tests to syntax tests --- test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol | 5 +++++ test/libsolidity/syntaxTests/parsing/emit_without_event.sol | 8 ++++++++ test/libsolidity/syntaxTests/parsing/empty_enum.sol | 5 +++++ test/libsolidity/syntaxTests/parsing/empty_function.sol | 10 ++++++++++ .../syntaxTests/parsing/event_with_no_argument_list.sol | 5 +++++ test/libsolidity/syntaxTests/parsing/external_variable.sol | 5 +++++ .../syntaxTests/parsing/fixed_literal_with_double_radix.sol | 5 +++++ .../function_type_as_storage_variable_with_modifiers.sol | 5 +++++ .../parsing/inline_array_empty_cells_check_lvalue.sol | 9 +++++++++ .../parsing/inline_array_empty_cells_check_without_lvalue.sol | 8 ++++++++ .../parsing/invalid_fixed_conversion_leading_zeroes_check.sol | 7 +++++++ test/libsolidity/syntaxTests/parsing/local_const_variable.sol | 9 +++++++++ .../parsing/location_specifiers_for_state_variables.sol | 5 +++++ .../syntaxTests/parsing/location_specifiers_with_var.sol | 5 +++++ .../syntaxTests/parsing/malformed_enum_declaration.sol | 5 +++++ .../syntaxTests/parsing/missing_argument_in_named_args.sol | 6 ++++++ .../parsing/missing_parameter_name_in_named_args.sol | 6 ++++++ .../syntaxTests/parsing/modifier_without_semicolon.sol | 5 +++++ test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol | 7 +++++++ test/libsolidity/syntaxTests/parsing/no_function_params.sol | 7 +++++++ test/libsolidity/syntaxTests/parsing/payable_accessor.sol | 5 +++++ test/libsolidity/syntaxTests/parsing/scientific_notation.sol | 7 +++++++ test/libsolidity/syntaxTests/parsing/single_function_param.sol | 9 +++++++++ .../parsing/single_function_param_trailing_comma.sol | 5 +++++ .../syntaxTests/parsing/single_return_param_trailing_comma.sol | 5 +++++ .../syntaxTests/parsing/trailing_comma_in_named_args.sol | 6 ++++++ test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol | 7 +++++++ test/libsolidity/syntaxTests/parsing/var_array.sol | 5 +++++ .../syntaxTests/parsing/variable_definition_in_mapping.sol | 7 +++++++ 29 files changed, 183 insertions(+) create mode 100644 test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol create mode 100644 test/libsolidity/syntaxTests/parsing/emit_without_event.sol create mode 100644 test/libsolidity/syntaxTests/parsing/empty_enum.sol create mode 100644 test/libsolidity/syntaxTests/parsing/empty_function.sol create mode 100644 test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol create mode 100644 test/libsolidity/syntaxTests/parsing/external_variable.sol create mode 100644 test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol create mode 100644 test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol create mode 100644 test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol create mode 100644 test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol create mode 100644 test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol create mode 100644 test/libsolidity/syntaxTests/parsing/local_const_variable.sol create mode 100644 test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol create mode 100644 test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol create mode 100644 test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol create mode 100644 test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol create mode 100644 test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol create mode 100644 test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol create mode 100644 test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol create mode 100644 test/libsolidity/syntaxTests/parsing/no_function_params.sol create mode 100644 test/libsolidity/syntaxTests/parsing/payable_accessor.sol create mode 100644 test/libsolidity/syntaxTests/parsing/scientific_notation.sol create mode 100644 test/libsolidity/syntaxTests/parsing/single_function_param.sol create mode 100644 test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol create mode 100644 test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol create mode 100644 test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol create mode 100644 test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol create mode 100644 test/libsolidity/syntaxTests/parsing/var_array.sol create mode 100644 test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol new file mode 100644 index 00000000..40e237d2 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -0,0 +1,5 @@ +contract Foo { + uint constant = 4; +} +// ---- +// ParserError: (30-30): Expected identifier, got 'Assign' diff --git a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol new file mode 100644 index 00000000..5916fc2b --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol @@ -0,0 +1,8 @@ +contract C { + event A(); + function f() { + emit A; + } +} +// ---- +// ParserError: (49-49): Expected token LParen got 'Semicolon' diff --git a/test/libsolidity/syntaxTests/parsing/empty_enum.sol b/test/libsolidity/syntaxTests/parsing/empty_enum.sol new file mode 100644 index 00000000..dd786cdc --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/empty_enum.sol @@ -0,0 +1,5 @@ +contract c { + enum foo { } +} +// ---- +// ParserError: (25-25): enum with no members is not allowed. diff --git a/test/libsolidity/syntaxTests/parsing/empty_function.sol b/test/libsolidity/syntaxTests/parsing/empty_function.sol new file mode 100644 index 00000000..4f845189 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/empty_function.sol @@ -0,0 +1,10 @@ +contract test { + uint256 stateVar; + function functionName(bytes20 arg1, address addr) constant returns (int id) { } +} +// ---- +// Warning: (36-115): No visibility specified. Defaulting to "public". +// Warning: (58-70): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (72-84): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (104-110): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (36-115): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol new file mode 100644 index 00000000..ae2591db --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol @@ -0,0 +1,5 @@ +contract c { + event e; +} +// ---- +// ParserError: (21-21): Expected token LParen got 'Semicolon' diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol new file mode 100644 index 00000000..5188875f --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -0,0 +1,5 @@ +contract c { + uint external x; +} +// ---- +// ParserError: (19-19): Expected identifier, got 'External' diff --git a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol new file mode 100644 index 00000000..43bb61fa --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol @@ -0,0 +1,5 @@ +contract A { + fixed40x40 pi = 3.14.15; +} +// ---- +// ParserError: (34-34): Expected token Semicolon got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol new file mode 100644 index 00000000..12480459 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol @@ -0,0 +1,5 @@ +contract test { + function (uint, uint) modifier1() returns (uint) f1; +} +// ---- +// ParserError: (66-66): Expected token LBrace got 'Identifier' diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol new file mode 100644 index 00000000..23052980 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol @@ -0,0 +1,9 @@ +contract c { + uint[] a; + function f() returns (uint) { + a = [,2,3]; + return (a[0]); + } +} +// ---- +// ParserError: (62-62): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol new file mode 100644 index 00000000..88c67619 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol @@ -0,0 +1,8 @@ +contract c { + uint[] a; + function f() returns (uint, uint) { + return ([3, ,4][0]); + } +} +// ---- +// ParserError: (75-75): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol new file mode 100644 index 00000000..e0c8fa9a --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol @@ -0,0 +1,7 @@ +contract test { + function f() { + fixed a = 1.0x2; + } +} +// ---- +// ParserError: (44-44): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol new file mode 100644 index 00000000..55673160 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol @@ -0,0 +1,9 @@ +contract Foo { + function localConst() returns (uint ret) + { + uint constant local = 4; + return local; + } +} +// ---- +// ParserError: (67-67): Expected token Semicolon got 'Constant' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol new file mode 100644 index 00000000..1b525506 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -0,0 +1,5 @@ +contract Foo { + uint[] memory x; +} +// ---- +// ParserError: (23-23): Expected identifier, got 'Memory' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol new file mode 100644 index 00000000..47fe37d5 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol @@ -0,0 +1,5 @@ +contract Foo { + function f() { var memory x; } +} +// ---- +// ParserError: (35-35): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol new file mode 100644 index 00000000..5a6eb270 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol @@ -0,0 +1,5 @@ +contract c { + enum foo { WARNING,} +} +// ---- +// ParserError: (33-33): Expected Identifier after ',' diff --git a/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol new file mode 100644 index 00000000..8e0acfaa --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol @@ -0,0 +1,6 @@ +contract test { + function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; } + function b() returns (uint r) { r = a({a: , b: , c: }); } +} +// ---- +// ParserError: (146-146): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol new file mode 100644 index 00000000..0606e2c7 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -0,0 +1,6 @@ +contract test { + function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; } + function b() returns (uint r) { r = a({: 1, : 2, : 3}); } +} +// ---- +// ParserError: (143-143): Expected identifier, got 'Colon' diff --git a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol new file mode 100644 index 00000000..0d719db4 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol @@ -0,0 +1,5 @@ +contract c { + modifier mod { if (msg.sender == 0) _ } +} +// ---- +// ParserError: (52-52): Expected token Semicolon got 'RBrace' diff --git a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol new file mode 100644 index 00000000..31cd1f09 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol @@ -0,0 +1,7 @@ +contract C { + function f() { + new var; + } +} +// ---- +// ParserError: (35-35): Expected explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/no_function_params.sol b/test/libsolidity/syntaxTests/parsing/no_function_params.sol new file mode 100644 index 00000000..020f1233 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/no_function_params.sol @@ -0,0 +1,7 @@ +contract test { + uint256 stateVar; + function functionName() {} +} +// ---- +// Warning: (36-62): No visibility specified. Defaulting to "public". +// Warning: (36-62): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol new file mode 100644 index 00000000..a73108ad --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -0,0 +1,5 @@ +contract test { + uint payable x; +} +// ---- +// ParserError: (22-22): Expected identifier, got 'Payable' diff --git a/test/libsolidity/syntaxTests/parsing/scientific_notation.sol b/test/libsolidity/syntaxTests/parsing/scientific_notation.sol new file mode 100644 index 00000000..5d656508 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/scientific_notation.sol @@ -0,0 +1,7 @@ +contract test { + uint256 a = 2e10; + uint256 b = 2E10; + uint256 c = 200e-2; + uint256 d = 2E10 wei; + uint256 e = 2.5e10; +} diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param.sol b/test/libsolidity/syntaxTests/parsing/single_function_param.sol new file mode 100644 index 00000000..08e531f1 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/single_function_param.sol @@ -0,0 +1,9 @@ +contract test { + uint256 stateVar; + function functionName(bytes32 input) returns (bytes32 out) {} +} +// ---- +// Warning: (36-97): No visibility specified. Defaulting to "public". +// Warning: (58-71): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (82-93): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (36-97): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol new file mode 100644 index 00000000..1febdab9 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol @@ -0,0 +1,5 @@ +contract test { + function(uint a,) {} +} +// ---- +// ParserError: (32-32): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol new file mode 100644 index 00000000..d2e3bbb3 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol @@ -0,0 +1,5 @@ +contract test { + function() returns (uint a,) {} +} +// ---- +// ParserError: (43-43): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol new file mode 100644 index 00000000..22efc58a --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol @@ -0,0 +1,6 @@ +contract test { + function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; } + function b() returns (uint r) { r = a({a: 1, b: 2, c: 3, }); } +} +// ---- +// ParserError: (159-159): Unexpected trailing comma. diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol new file mode 100644 index 00000000..d0e376b0 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -0,0 +1,7 @@ +contract C { + function f() { + var a = (2 2); + } +} +// ---- +// ParserError: (42-42): Expected token Comma got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol new file mode 100644 index 00000000..60f6dc28 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -0,0 +1,5 @@ +contract Foo { + function f() { var[] a; } +} +// ---- +// ParserError: (34-34): Expected identifier, got 'LBrack' diff --git a/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol new file mode 100644 index 00000000..ec55a4db --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol @@ -0,0 +1,7 @@ +contract test { + function fun() { + mapping(var=>bytes32) d; + } +} +// ---- +// ParserError: (44-44): Expected elementary type name for mapping key type -- cgit v1.2.3 From ed9f80690bde53e56c6ef5cb046fb20713f3f780 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 20:42:26 +0100 Subject: Simplify expectIdentifierToken by using expectToken --- test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol | 2 +- test/libsolidity/syntaxTests/parsing/external_variable.sol | 2 +- .../syntaxTests/parsing/location_specifiers_for_state_variables.sol | 2 +- .../syntaxTests/parsing/missing_parameter_name_in_named_args.sol | 2 +- .../syntaxTests/parsing/missing_variable_name_in_declaration.sol | 2 +- test/libsolidity/syntaxTests/parsing/payable_accessor.sol | 2 +- test/libsolidity/syntaxTests/parsing/var_array.sol | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol index 40e237d2..59fe8518 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -2,4 +2,4 @@ contract Foo { uint constant = 4; } // ---- -// ParserError: (30-30): Expected identifier, got 'Assign' +// ParserError: (30-30): Expected token Identifier got 'Assign' diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol index 5188875f..1d2e65e6 100644 --- a/test/libsolidity/syntaxTests/parsing/external_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -2,4 +2,4 @@ contract c { uint external x; } // ---- -// ParserError: (19-19): Expected identifier, got 'External' +// ParserError: (19-19): Expected token Identifier got 'External' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol index 1b525506..0fc85177 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory x; } // ---- -// ParserError: (23-23): Expected identifier, got 'Memory' +// ParserError: (23-23): Expected token Identifier got 'Memory' diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol index 0606e2c7..3604f3b2 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({: 1, : 2, : 3}); } } // ---- -// ParserError: (143-143): Expected identifier, got 'Colon' +// ParserError: (143-143): Expected token Identifier got 'Colon' diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index fd3067e3..bb1d015b 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: (28-28): Expected identifier, got 'Semicolon' +// ParserError: (28-28): Expected token Identifier got 'Semicolon' diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol index a73108ad..44b04afd 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -2,4 +2,4 @@ contract test { uint payable x; } // ---- -// ParserError: (22-22): Expected identifier, got 'Payable' +// ParserError: (22-22): Expected token Identifier got 'Payable' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index 60f6dc28..86fc4fcb 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError: (34-34): Expected identifier, got 'LBrack' +// ParserError: (34-34): Expected token Identifier got 'LBrack' -- cgit v1.2.3 From 840ed1e88a8d70bdbc541a1330654cb1e730e298 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 19:49:36 +0100 Subject: Update parser test expectations --- test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol | 2 +- test/libsolidity/syntaxTests/parsing/emit_without_event.sol | 2 +- test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol | 2 +- test/libsolidity/syntaxTests/parsing/external_variable.sol | 2 +- .../libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol | 2 +- .../parsing/function_type_as_storage_variable_with_modifiers.sol | 2 +- test/libsolidity/syntaxTests/parsing/local_const_variable.sol | 2 +- .../syntaxTests/parsing/location_specifiers_for_state_variables.sol | 2 +- test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol | 2 +- .../syntaxTests/parsing/missing_parameter_name_in_named_args.sol | 2 +- .../syntaxTests/parsing/missing_variable_name_in_declaration.sol | 2 +- test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol | 2 +- test/libsolidity/syntaxTests/parsing/payable_accessor.sol | 2 +- test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol | 2 +- test/libsolidity/syntaxTests/parsing/var_array.sol | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol index 59fe8518..da3fa1c6 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -2,4 +2,4 @@ contract Foo { uint constant = 4; } // ---- -// ParserError: (30-30): Expected token Identifier got 'Assign' +// ParserError: (30-30): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol index 5916fc2b..1af1d4ab 100644 --- a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol +++ b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (49-49): Expected token LParen got 'Semicolon' +// ParserError: (49-49): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol index ae2591db..850c3627 100644 --- a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol +++ b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol @@ -2,4 +2,4 @@ contract c { event e; } // ---- -// ParserError: (21-21): Expected token LParen got 'Semicolon' +// ParserError: (21-21): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol index 1d2e65e6..2de70e23 100644 --- a/test/libsolidity/syntaxTests/parsing/external_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -2,4 +2,4 @@ contract c { uint external x; } // ---- -// ParserError: (19-19): Expected token Identifier got 'External' +// ParserError: (19-19): Expected identifier but got 'external' diff --git a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol index 43bb61fa..b3adc03d 100644 --- a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol +++ b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol @@ -2,4 +2,4 @@ contract A { fixed40x40 pi = 3.14.15; } // ---- -// ParserError: (34-34): Expected token Semicolon got 'Number' +// ParserError: (34-34): Expected ';' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol index 12480459..198d250b 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol @@ -2,4 +2,4 @@ contract test { function (uint, uint) modifier1() returns (uint) f1; } // ---- -// ParserError: (66-66): Expected token LBrace got 'Identifier' +// ParserError: (66-66): Expected '{' but got identifier diff --git a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol index 55673160..f06e2501 100644 --- a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol @@ -6,4 +6,4 @@ contract Foo { } } // ---- -// ParserError: (67-67): Expected token Semicolon got 'Constant' +// ParserError: (67-67): Expected ';' but got 'constant' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol index 0fc85177..9cc7a4fa 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory x; } // ---- -// ParserError: (23-23): Expected token Identifier got 'Memory' +// ParserError: (23-23): Expected identifier but got 'memory' diff --git a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol index 5a6eb270..9fc7efff 100644 --- a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol @@ -2,4 +2,4 @@ contract c { enum foo { WARNING,} } // ---- -// ParserError: (33-33): Expected Identifier after ',' +// ParserError: (33-33): Expected identifier after ',' diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol index 3604f3b2..b950c76a 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({: 1, : 2, : 3}); } } // ---- -// ParserError: (143-143): Expected token Identifier got 'Colon' +// ParserError: (143-143): Expected identifier but got ':' diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index bb1d015b..15927f50 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: (28-28): Expected token Identifier got 'Semicolon' +// ParserError: (28-28): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol index 0d719db4..1b488837 100644 --- a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol +++ b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol @@ -2,4 +2,4 @@ contract c { modifier mod { if (msg.sender == 0) _ } } // ---- -// ParserError: (52-52): Expected token Semicolon got 'RBrace' +// ParserError: (52-52): Expected ';' but got '}' diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol index 44b04afd..46bf6e13 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -2,4 +2,4 @@ contract test { uint payable x; } // ---- -// ParserError: (22-22): Expected token Identifier got 'Payable' +// ParserError: (22-22): Expected identifier but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol index d0e376b0..e283e0bb 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (42-42): Expected token Comma got 'Number' +// ParserError: (42-42): Expected ',' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index 86fc4fcb..d635a04b 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError: (34-34): Expected token Identifier got 'LBrack' +// ParserError: (34-34): Expected identifier but got '[' -- cgit v1.2.3 From 305fc0626bbab7ac7c4f4f9511e2059abd84c9de Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 9 May 2018 13:15:27 +0200 Subject: Update test expectations. --- .../syntaxTests/parsing/constant_is_keyword.sol | 2 +- .../syntaxTests/parsing/emit_without_event.sol | 2 +- .../libsolidity/syntaxTests/parsing/empty_enum.sol | 2 +- .../parsing/event_with_no_argument_list.sol | 2 +- .../syntaxTests/parsing/external_variable.sol | 2 +- .../parsing/fixed_literal_with_double_radix.sol | 2 +- ...ion_type_as_storage_variable_with_modifiers.sol | 2 +- .../inline_array_empty_cells_check_lvalue.sol | 2 +- ...line_array_empty_cells_check_without_lvalue.sol | 2 +- ...valid_fixed_conversion_leading_zeroes_check.sol | 2 +- .../syntaxTests/parsing/local_const_variable.sol | 2 +- .../location_specifiers_for_state_variables.sol | 2 +- .../parsing/location_specifiers_with_var.sol | 2 +- .../parsing/malformed_enum_declaration.sol | 2 +- .../parsing/missing_argument_in_named_args.sol | 2 +- .../missing_parameter_name_in_named_args.sol | 2 +- .../missing_variable_name_in_declaration.sol | 2 +- .../parsing/modifier_without_semicolon.sol | 2 +- .../syntaxTests/parsing/new_invalid_type_name.sol | 2 +- .../syntaxTests/parsing/payable_accessor.sol | 2 +- .../libsolidity/syntaxTests/parsing/return_var.sol | 28 +++++++++++----------- .../single_function_param_trailing_comma.sol | 2 +- .../parsing/single_return_param_trailing_comma.sol | 2 +- .../parsing/trailing_comma_in_named_args.sol | 2 +- .../syntaxTests/parsing/tuples_without_commas.sol | 2 +- test/libsolidity/syntaxTests/parsing/var_array.sol | 2 +- .../parsing/var_in_function_arguments.sol | 28 +++++++++++----------- .../syntaxTests/parsing/var_storage_var.sol | 2 +- .../parsing/variable_definition_in_mapping.sol | 2 +- 29 files changed, 55 insertions(+), 55 deletions(-) (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol index da3fa1c6..26d126ce 100644 --- a/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol +++ b/test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol @@ -2,4 +2,4 @@ contract Foo { uint constant = 4; } // ---- -// ParserError: (30-30): Expected identifier but got '=' +// ParserError: (30-31): Expected identifier but got '=' diff --git a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol index 1af1d4ab..b838b4af 100644 --- a/test/libsolidity/syntaxTests/parsing/emit_without_event.sol +++ b/test/libsolidity/syntaxTests/parsing/emit_without_event.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// ParserError: (49-49): Expected '(' but got ';' +// ParserError: (49-50): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/empty_enum.sol b/test/libsolidity/syntaxTests/parsing/empty_enum.sol index dd786cdc..483f6a91 100644 --- a/test/libsolidity/syntaxTests/parsing/empty_enum.sol +++ b/test/libsolidity/syntaxTests/parsing/empty_enum.sol @@ -2,4 +2,4 @@ contract c { enum foo { } } // ---- -// ParserError: (25-25): enum with no members is not allowed. +// ParserError: (25-26): enum with no members is not allowed. diff --git a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol index 850c3627..b38c7dc9 100644 --- a/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol +++ b/test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol @@ -2,4 +2,4 @@ contract c { event e; } // ---- -// ParserError: (21-21): Expected '(' but got ';' +// ParserError: (21-22): Expected '(' but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/external_variable.sol b/test/libsolidity/syntaxTests/parsing/external_variable.sol index 2de70e23..2a02d19a 100644 --- a/test/libsolidity/syntaxTests/parsing/external_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/external_variable.sol @@ -2,4 +2,4 @@ contract c { uint external x; } // ---- -// ParserError: (19-19): Expected identifier but got 'external' +// ParserError: (19-27): Expected identifier but got 'external' diff --git a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol index b3adc03d..0d5734aa 100644 --- a/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol +++ b/test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol @@ -2,4 +2,4 @@ contract A { fixed40x40 pi = 3.14.15; } // ---- -// ParserError: (34-34): Expected ';' but got 'Number' +// ParserError: (34-37): Expected ';' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol index 198d250b..6c22f4b7 100644 --- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol +++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol @@ -2,4 +2,4 @@ contract test { function (uint, uint) modifier1() returns (uint) f1; } // ---- -// ParserError: (66-66): Expected '{' but got identifier +// ParserError: (66-68): Expected '{' but got identifier diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol index 23052980..9460751c 100644 --- a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// ParserError: (62-62): Expected expression (inline array elements cannot be omitted). +// ParserError: (62-63): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol index 88c67619..5b78232d 100644 --- a/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol +++ b/test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol @@ -5,4 +5,4 @@ contract c { } } // ---- -// ParserError: (75-75): Expected expression (inline array elements cannot be omitted). +// ParserError: (75-76): Expected expression (inline array elements cannot be omitted). diff --git a/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol index e0c8fa9a..fb267ba3 100644 --- a/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol +++ b/test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// ParserError: (44-44): Expected primary expression. +// ParserError: (44-47): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol index f06e2501..505fe0b5 100644 --- a/test/libsolidity/syntaxTests/parsing/local_const_variable.sol +++ b/test/libsolidity/syntaxTests/parsing/local_const_variable.sol @@ -6,4 +6,4 @@ contract Foo { } } // ---- -// ParserError: (67-67): Expected ';' but got 'constant' +// ParserError: (67-75): Expected ';' but got 'constant' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol index 9cc7a4fa..40eaf838 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol @@ -2,4 +2,4 @@ contract Foo { uint[] memory x; } // ---- -// ParserError: (23-23): Expected identifier but got 'memory' +// ParserError: (23-29): Expected identifier but got 'memory' diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol index 47fe37d5..2b8f08c5 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var memory x; } } // ---- -// ParserError: (35-35): Location specifier needs explicit type name. +// ParserError: (35-41): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol index 9fc7efff..811b4219 100644 --- a/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol @@ -2,4 +2,4 @@ contract c { enum foo { WARNING,} } // ---- -// ParserError: (33-33): Expected identifier after ',' +// ParserError: (33-34): Expected identifier after ',' diff --git a/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol index 8e0acfaa..f7c3fb31 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({a: , b: , c: }); } } // ---- -// ParserError: (146-146): Expected primary expression. +// ParserError: (146-147): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol index b950c76a..d7c2f2be 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({: 1, : 2, : 3}); } } // ---- -// ParserError: (143-143): Expected identifier but got ':' +// ParserError: (143-144): Expected identifier but got ':' diff --git a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol index 15927f50..51b7bd24 100644 --- a/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol +++ b/test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol @@ -2,4 +2,4 @@ contract test { uint256 ; } // ---- -// ParserError: (28-28): Expected identifier but got ';' +// ParserError: (28-29): Expected identifier but got ';' diff --git a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol index 1b488837..a9fa33e6 100644 --- a/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol +++ b/test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol @@ -2,4 +2,4 @@ contract c { modifier mod { if (msg.sender == 0) _ } } // ---- -// ParserError: (52-52): Expected ';' but got '}' +// ParserError: (52-53): Expected ';' but got '}' diff --git a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol index 31cd1f09..d469bc75 100644 --- a/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol +++ b/test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (35-35): Expected explicit type name. +// ParserError: (35-38): Expected explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol index 46bf6e13..6504004b 100644 --- a/test/libsolidity/syntaxTests/parsing/payable_accessor.sol +++ b/test/libsolidity/syntaxTests/parsing/payable_accessor.sol @@ -2,4 +2,4 @@ contract test { uint payable x; } // ---- -// ParserError: (22-22): Expected identifier but got 'payable' +// ParserError: (22-29): Expected identifier but got 'payable' diff --git a/test/libsolidity/syntaxTests/parsing/return_var.sol b/test/libsolidity/syntaxTests/parsing/return_var.sol index 47ac9ef0..b9ce8f95 100644 --- a/test/libsolidity/syntaxTests/parsing/return_var.sol +++ b/test/libsolidity/syntaxTests/parsing/return_var.sol @@ -9,17 +9,17 @@ contract C { function f() public pure returns (var storage x, var storage y) {} } // ---- -// ParserError: (38-38): Expected explicit type name. -// ParserError: (71-71): Expected explicit type name. -// ParserError: (106-106): Expected explicit type name. -// ParserError: (157-157): Expected explicit type name. -// ParserError: (192-192): Expected explicit type name. -// ParserError: (199-199): Expected explicit type name. -// ParserError: (247-247): Expected explicit type name. -// ParserError: (251-251): Location specifier needs explicit type name. -// ParserError: (301-301): Expected explicit type name. -// ParserError: (305-305): Location specifier needs explicit type name. -// ParserError: (357-357): Expected explicit type name. -// ParserError: (361-361): Location specifier needs explicit type name. -// ParserError: (372-372): Expected explicit type name. -// ParserError: (376-376): Location specifier needs explicit type name. +// ParserError: (38-41): Expected explicit type name. +// ParserError: (71-74): Expected explicit type name. +// ParserError: (106-109): Expected explicit type name. +// ParserError: (157-160): Expected explicit type name. +// ParserError: (192-195): Expected explicit type name. +// ParserError: (199-202): Expected explicit type name. +// ParserError: (247-250): Expected explicit type name. +// ParserError: (251-258): Location specifier needs explicit type name. +// ParserError: (301-304): Expected explicit type name. +// ParserError: (305-312): Location specifier needs explicit type name. +// ParserError: (357-360): Expected explicit type name. +// ParserError: (361-368): Location specifier needs explicit type name. +// ParserError: (372-375): Expected explicit type name. +// ParserError: (376-383): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol index 1febdab9..fe52b3b2 100644 --- a/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function(uint a,) {} } // ---- -// ParserError: (32-32): Unexpected trailing comma in parameter list. +// ParserError: (32-33): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol index d2e3bbb3..99f91819 100644 --- a/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol +++ b/test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol @@ -2,4 +2,4 @@ contract test { function() returns (uint a,) {} } // ---- -// ParserError: (43-43): Unexpected trailing comma in parameter list. +// ParserError: (43-44): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol index 22efc58a..8fc3dab8 100644 --- a/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol +++ b/test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol @@ -3,4 +3,4 @@ contract test { function b() returns (uint r) { r = a({a: 1, b: 2, c: 3, }); } } // ---- -// ParserError: (159-159): Unexpected trailing comma. +// ParserError: (159-160): Unexpected trailing comma. diff --git a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol index e283e0bb..fcbb875c 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// ParserError: (42-42): Expected ',' but got 'Number' +// ParserError: (42-43): Expected ',' but got 'Number' diff --git a/test/libsolidity/syntaxTests/parsing/var_array.sol b/test/libsolidity/syntaxTests/parsing/var_array.sol index d635a04b..e08f5511 100644 --- a/test/libsolidity/syntaxTests/parsing/var_array.sol +++ b/test/libsolidity/syntaxTests/parsing/var_array.sol @@ -2,4 +2,4 @@ contract Foo { function f() { var[] a; } } // ---- -// ParserError: (34-34): Expected identifier but got '[' +// ParserError: (34-35): Expected identifier but got '[' diff --git a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol index e041247d..2e5a9c58 100644 --- a/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol +++ b/test/libsolidity/syntaxTests/parsing/var_in_function_arguments.sol @@ -9,17 +9,17 @@ contract C { function f(var storage x, var storage y) public pure {} } // ---- -// ParserError: (28-28): Expected explicit type name. -// ParserError: (63-63): Expected explicit type name. -// ParserError: (100-100): Expected explicit type name. -// ParserError: (107-107): Expected explicit type name. -// ParserError: (152-152): Expected explicit type name. -// ParserError: (189-189): Expected explicit type name. -// ParserError: (234-234): Expected explicit type name. -// ParserError: (238-238): Location specifier needs explicit type name. -// ParserError: (277-277): Expected explicit type name. -// ParserError: (281-281): Location specifier needs explicit type name. -// ParserError: (322-322): Expected explicit type name. -// ParserError: (326-326): Location specifier needs explicit type name. -// ParserError: (337-337): Expected explicit type name. -// ParserError: (341-341): Location specifier needs explicit type name. +// ParserError: (28-31): Expected explicit type name. +// ParserError: (63-66): Expected explicit type name. +// ParserError: (100-103): Expected explicit type name. +// ParserError: (107-110): Expected explicit type name. +// ParserError: (152-155): Expected explicit type name. +// ParserError: (189-192): Expected explicit type name. +// ParserError: (234-237): Expected explicit type name. +// ParserError: (238-245): Location specifier needs explicit type name. +// ParserError: (277-280): Expected explicit type name. +// ParserError: (281-288): Location specifier needs explicit type name. +// ParserError: (322-325): Expected explicit type name. +// ParserError: (326-333): Location specifier needs explicit type name. +// ParserError: (337-340): Expected explicit type name. +// ParserError: (341-348): Location specifier needs explicit type name. diff --git a/test/libsolidity/syntaxTests/parsing/var_storage_var.sol b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol index 431d4ca5..6e4ccfa5 100644 --- a/test/libsolidity/syntaxTests/parsing/var_storage_var.sol +++ b/test/libsolidity/syntaxTests/parsing/var_storage_var.sol @@ -2,4 +2,4 @@ contract C { var a; } // ---- -// ParserError: (17-17): Function, variable, struct or modifier declaration expected. +// ParserError: (17-20): Function, variable, struct or modifier declaration expected. diff --git a/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol index ec55a4db..61f5be53 100644 --- a/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol +++ b/test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol @@ -4,4 +4,4 @@ contract test { } } // ---- -// ParserError: (44-44): Expected elementary type name for mapping key type +// ParserError: (44-47): Expected elementary type name for mapping key type -- cgit v1.2.3 From bc47265b3f6d5c15b5c57c3edc927448a8599096 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 8 May 2018 13:08:52 +0200 Subject: Replace constant with view in the tests. --- .../parsing/constant_state_modifier.sol | 7 +++++ .../syntaxTests/parsing/empty_function.sol | 8 +++--- .../multiple_statemutability_specifiers.sol | 33 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol create mode 100644 test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol new file mode 100644 index 00000000..da068351 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol @@ -0,0 +1,7 @@ +contract C { + uint s; + // this test should fail starting from 0.5.0 + function f() public constant returns (uint) { + return s; + } +} diff --git a/test/libsolidity/syntaxTests/parsing/empty_function.sol b/test/libsolidity/syntaxTests/parsing/empty_function.sol index 4f845189..218fd9a7 100644 --- a/test/libsolidity/syntaxTests/parsing/empty_function.sol +++ b/test/libsolidity/syntaxTests/parsing/empty_function.sol @@ -1,10 +1,10 @@ contract test { uint256 stateVar; - function functionName(bytes20 arg1, address addr) constant returns (int id) { } + function functionName(bytes20 arg1, address addr) view returns (int id) { } } // ---- -// Warning: (36-115): No visibility specified. Defaulting to "public". +// Warning: (36-111): No visibility specified. Defaulting to "public". // Warning: (58-70): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning: (72-84): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (104-110): Unused function parameter. Remove or comment out the variable name to silence this warning. -// Warning: (36-115): Function state mutability can be restricted to pure +// Warning: (100-106): Unused function parameter. Remove or comment out the variable name to silence this warning. +// Warning: (36-111): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol new file mode 100644 index 00000000..a05bf452 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol @@ -0,0 +1,33 @@ +contract c1 { + function f() payable payable {} +} +contract c2 { + function f() view view {} +} +contract c3 { + function f() pure pure {} +} +contract c4 { + function f() pure view {} +} +contract c5 { + function f() payable view {} +} +contract c6 { + function f() pure payable {} +} +contract c7 { + function f() pure constant {} +} +contract c8 { + function f() view constant {} +} +// ---- +// ParserError: (39-46): State mutability already specified as "payable". +// ParserError: (88-92): State mutability already specified as "view". +// ParserError: (134-138): State mutability already specified as "pure". +// ParserError: (180-184): State mutability already specified as "pure". +// ParserError: (229-233): State mutability already specified as "payable". +// ParserError: (275-282): State mutability already specified as "pure". +// ParserError: (324-332): State mutability already specified as "pure". +// ParserError: (374-382): State mutability already specified as "view". -- cgit v1.2.3 From 7fb43fe8542679fe91fef460d1a5d15fb8f83cca Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 16 May 2018 03:06:47 +0200 Subject: Move couple of parser tests to syntax tests. --- .../parsing/comment_end_with_double_star.sol | 5 ++++ .../syntaxTests/parsing/empty_comment.sol | 3 +++ .../syntaxTests/parsing/function_no_body.sol | 5 ++++ .../parsing/function_type_state_variable.sol | 4 +++ .../syntaxTests/parsing/interface_basic.sol | 6 +++++ .../parsing/multi_variable_declarations.sol | 29 ++++++++++++++++++++++ .../multiple_function_param_trailing_comma.sol | 5 ++++ .../syntaxTests/parsing/overloaded_functions.sol | 9 +++++++ .../parsing/single_event_arg_trailing_comma.sol | 6 +++++ .../parsing/single_modifier_arg_trailing_comma.sol | 6 +++++ test/libsolidity/syntaxTests/parsing/tuples.sol | 24 ++++++++++++++++++ 11 files changed, 102 insertions(+) create mode 100644 test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol create mode 100644 test/libsolidity/syntaxTests/parsing/empty_comment.sol create mode 100644 test/libsolidity/syntaxTests/parsing/function_no_body.sol create mode 100644 test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol create mode 100644 test/libsolidity/syntaxTests/parsing/interface_basic.sol create mode 100644 test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol create mode 100644 test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol create mode 100644 test/libsolidity/syntaxTests/parsing/overloaded_functions.sol create mode 100644 test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol create mode 100644 test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol create mode 100644 test/libsolidity/syntaxTests/parsing/tuples.sol (limited to 'test/libsolidity/syntaxTests/parsing') diff --git a/test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol b/test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol new file mode 100644 index 00000000..d3fcae9b --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol @@ -0,0 +1,5 @@ +contract C1 { +/** + **/ +} +contract C2 {} diff --git a/test/libsolidity/syntaxTests/parsing/empty_comment.sol b/test/libsolidity/syntaxTests/parsing/empty_comment.sol new file mode 100644 index 00000000..b39c8483 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/empty_comment.sol @@ -0,0 +1,3 @@ +// +contract test +{} diff --git a/test/libsolidity/syntaxTests/parsing/function_no_body.sol b/test/libsolidity/syntaxTests/parsing/function_no_body.sol new file mode 100644 index 00000000..0424ebd8 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/function_no_body.sol @@ -0,0 +1,5 @@ +contract test { + function functionName(bytes32 input) returns (bytes32 out); +} +// ---- +// Warning: (17-76): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol b/test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol new file mode 100644 index 00000000..eff52c7c --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol @@ -0,0 +1,4 @@ +contract test { + function() x; + function() y = x; +} \ No newline at end of file diff --git a/test/libsolidity/syntaxTests/parsing/interface_basic.sol b/test/libsolidity/syntaxTests/parsing/interface_basic.sol new file mode 100644 index 00000000..c25b48ba --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/interface_basic.sol @@ -0,0 +1,6 @@ +interface Interface { + function f(); +} +// ---- +// Warning: (23-36): Functions in interfaces should be declared external. +// Warning: (23-36): No visibility specified. Defaulting to "public". In interfaces it defaults to external. diff --git a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol new file mode 100644 index 00000000..818999df --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol @@ -0,0 +1,29 @@ +contract C { + function f() { + var (a,b,c) = g(); + var (d) = 2; + var (,e) = 3; + var (f,) = 4; + var (x,,) = g(); + var (,y,) = g(); + var () = g(); + var (,,) = g(); + } + function g() returns (uint, uint, uint) {} +} +// ---- +// Warning: (36-37): Use of the "var" keyword is deprecated. +// Warning: (38-39): Use of the "var" keyword is deprecated. +// Warning: (40-41): Use of the "var" keyword is deprecated. +// Warning: (57-58): Use of the "var" keyword is deprecated. +// Warning: (73-74): Use of the "var" keyword is deprecated. +// Warning: (88-89): Use of the "var" keyword is deprecated. +// Warning: (104-105): Use of the "var" keyword is deprecated. +// Warning: (124-125): Use of the "var" keyword is deprecated. +// Warning: (88-89): This declaration shadows an existing declaration. +// Warning: (52-63): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (67-79): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (67-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (83-95): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (83-95): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// TypeError: (137-149): Too many components (3) in value for variable assignment (0) needed diff --git a/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol new file mode 100644 index 00000000..ae65b33c --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol @@ -0,0 +1,5 @@ +contract test { + function(uint a, uint b,) {} +} +// ---- +// ParserError: (40-41): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol new file mode 100644 index 00000000..1a78d155 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol @@ -0,0 +1,9 @@ +contract test { + function fun(uint a) returns(uint r) { return a; } + function fun(uint a, uint b) returns(uint r) { return a + b; } +} +// ---- +// Warning: (17-67): No visibility specified. Defaulting to "public". +// Warning: (69-131): No visibility specified. Defaulting to "public". +// Warning: (17-67): Function state mutability can be restricted to pure +// Warning: (69-131): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol new file mode 100644 index 00000000..50638dc7 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol @@ -0,0 +1,6 @@ +contract test { + event Test(uint a,); + function(uint a) {} +} +// ---- +// ParserError: (34-35): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol b/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol new file mode 100644 index 00000000..2f60405f --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol @@ -0,0 +1,6 @@ +contract test { + modifier modTest(uint a,) { _; } + function(uint a) {} +} +// ---- +// ParserError: (40-41): Unexpected trailing comma in parameter list. diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol new file mode 100644 index 00000000..6f739740 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/tuples.sol @@ -0,0 +1,24 @@ +contract C { + function f() { + uint a = (1); + var (b,) = (1,); + var (c,d) = (1, 2 + a); + var (e,) = (1, 2, b); + (a) = 3; + } +} +// ---- +// Warning: (52-53): Use of the "var" keyword is deprecated. +// Warning: (71-72): Use of the "var" keyword is deprecated. +// Warning: (73-74): Use of the "var" keyword is deprecated. +// Warning: (97-98): Use of the "var" keyword is deprecated. +// Warning: (47-62): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (47-62): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (66-88): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (92-112): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (92-112): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (14-127): No visibility specified. Defaulting to "public". +// Warning: (71-72): Unused local variable. +// Warning: (73-74): Unused local variable. +// Warning: (97-98): Unused local variable. +// Warning: (14-127): Function state mutability can be restricted to pure -- cgit v1.2.3