aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-22 23:26:49 +0800
committerGitHub <noreply@github.com>2018-04-22 23:26:49 +0800
commit2fae248dbe50bed93268529724c1e3691f3c4a3f (patch)
tree7a10c7c481458da419efb98fca7a3547849f6bf4 /test
parentd674cde34cc0f9a8e8a520c8eddd2090384fb739 (diff)
parent0493e3b0534ae165a9de934c327997dc58621256 (diff)
downloaddexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar.gz
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar.bz2
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar.lz
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar.xz
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.tar.zst
dexon-solidity-2fae248dbe50bed93268529724c1e3691f3c4a3f.zip
Merge pull request #3957 from ethereum/deprecated-error
Turn deprecated warnings for sha3/suicide into errors (experimental 0.5.0)
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp27
-rw-r--r--test/libsolidity/syntaxTests/deprecated_functions.sol12
-rw-r--r--test/libsolidity/syntaxTests/deprecated_functions_050.sol13
-rw-r--r--test/libsolidity/syntaxTests/tight_packing_literals_050.sol2
4 files changed, 27 insertions, 27 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 97cf0410..3081b8f2 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5823,7 +5823,7 @@ BOOST_AUTO_TEST_CASE(bare_others)
CHECK_WARNING("contract C { function f() pure public { assert; } }", "Statement has no effect.");
// This is different because it does have overloads.
CHECK_ERROR("contract C { function f() pure public { require; } }", TypeError, "No matching declaration found after variable lookup.");
- CHECK_WARNING("contract C { function f() pure public { suicide; } }", "Statement has no effect.");
+ CHECK_WARNING("contract C { function f() pure public { selfdestruct; } }", "Statement has no effect.");
}
BOOST_AUTO_TEST_CASE(pure_statement_in_for_loop)
@@ -6958,31 +6958,6 @@ BOOST_AUTO_TEST_CASE(invalid_literal_in_tuple)
CHECK_SUCCESS(text);
}
-BOOST_AUTO_TEST_CASE(warn_about_sha3)
-{
- char const* text = R"(
- contract test {
- function f() pure public {
- bytes32 x = sha3(uint8(1));
- x;
- }
- }
- )";
- CHECK_WARNING(text, "\"sha3\" has been deprecated in favour of \"keccak256\"");
-}
-
-BOOST_AUTO_TEST_CASE(warn_about_suicide)
-{
- char const* text = R"(
- contract test {
- function f() public {
- suicide(1);
- }
- }
- )";
- CHECK_WARNING(text, "\"suicide\" has been deprecated in favour of \"selfdestruct\"");
-}
-
BOOST_AUTO_TEST_CASE(address_overload_resolution)
{
char const* text = R"(
diff --git a/test/libsolidity/syntaxTests/deprecated_functions.sol b/test/libsolidity/syntaxTests/deprecated_functions.sol
new file mode 100644
index 00000000..57ee484a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/deprecated_functions.sol
@@ -0,0 +1,12 @@
+contract test {
+ function f() pure public {
+ bytes32 x = sha3(uint8(1));
+ x;
+ }
+ function g() public {
+ suicide(1);
+ }
+}
+// ----
+// Warning: (58-72): "sha3" has been deprecated in favour of "keccak256"
+// Warning: (107-117): "suicide" has been deprecated in favour of "selfdestruct"
diff --git a/test/libsolidity/syntaxTests/deprecated_functions_050.sol b/test/libsolidity/syntaxTests/deprecated_functions_050.sol
new file mode 100644
index 00000000..7e36543b
--- /dev/null
+++ b/test/libsolidity/syntaxTests/deprecated_functions_050.sol
@@ -0,0 +1,13 @@
+pragma experimental "v0.5.0";
+contract test {
+ function f() pure public {
+ bytes32 x = sha3(uint8(1));
+ x;
+ }
+ function g() public {
+ suicide(1);
+ }
+}
+// ----
+// TypeError: (88-102): "sha3" has been deprecated in favour of "keccak256"
+// TypeError: (137-147): "suicide" has been deprecated in favour of "selfdestruct"
diff --git a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol b/test/libsolidity/syntaxTests/tight_packing_literals_050.sol
index 617af543..ef6da75d 100644
--- a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol
+++ b/test/libsolidity/syntaxTests/tight_packing_literals_050.sol
@@ -19,7 +19,7 @@ contract C {
// ----
// TypeError: (117-118): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
-// Warning: (191-198): "sha3" has been deprecated in favour of "keccak256"
+// TypeError: (191-198): "sha3" has been deprecated in favour of "keccak256"
// TypeError: (196-197): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (277-278): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (361-362): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.