aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_comment.sol3
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_no_body.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/interface_basic.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol29
-rw-r--r--test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/overloaded_functions.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol6
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples.sol24
11 files changed, 102 insertions, 0 deletions
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