aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/emit_without_event.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_enum.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_function.sol10
-rw-r--r--test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/external_variable.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_lvalue.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/inline_array_empty_cells_check_without_lvalue.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/local_const_variable.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/missing_argument_in_named_args.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/missing_parameter_name_in_named_args.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/no_function_params.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/payable_accessor.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/scientific_notation.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_function_param.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/trailing_comma_in_named_args.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/var_array.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol7
29 files changed, 183 insertions, 0 deletions
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