aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/parsing
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-05-08 19:08:52 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-05-09 21:07:47 +0800
commitbc47265b3f6d5c15b5c57c3edc927448a8599096 (patch)
tree649d1225fa558a1ee13c8c325fd510082d0e45b0 /test/libsolidity/syntaxTests/parsing
parent5cbe3e1a50f4aed7d07b7c45f115ac97df2c885a (diff)
downloaddexon-solidity-bc47265b3f6d5c15b5c57c3edc927448a8599096.tar.gz
dexon-solidity-bc47265b3f6d5c15b5c57c3edc927448a8599096.tar.zst
dexon-solidity-bc47265b3f6d5c15b5c57c3edc927448a8599096.zip
Replace constant with view in the tests.
Diffstat (limited to 'test/libsolidity/syntaxTests/parsing')
-rw-r--r--test/libsolidity/syntaxTests/parsing/constant_state_modifier.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_function.sol8
-rw-r--r--test/libsolidity/syntaxTests/parsing/multiple_statemutability_specifiers.sol33
3 files changed, 44 insertions, 4 deletions
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".