aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-22 19:11:37 +0800
committerGitHub <noreply@github.com>2017-08-22 19:11:37 +0800
commit97169e58ae44e763323f2554f124eaf1ff3db508 (patch)
tree96512e3347e61427fabb7d6d8a4c67658dda1d59 /test
parentf874fc28d1cb657b6d4e04fa9d93bd8d061f30c4 (diff)
parent7b0046a9aafffec4e42be7e30c283e07ca1841b9 (diff)
downloaddexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar.gz
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar.bz2
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar.lz
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar.xz
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.tar.zst
dexon-solidity-97169e58ae44e763323f2554f124eaf1ff3db508.zip
Merge pull request #2734 from ethereum/reject-create-interface
Reject the creation of interface with the new statement
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index e349bf83..f5f607ca 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6709,6 +6709,41 @@ BOOST_AUTO_TEST_CASE(experimental_pragma)
// CHECK_ERROR_ALLOW_MULTI(text, SyntaxError, "Duplicate experimental feature name.");
}
+BOOST_AUTO_TEST_CASE(reject_interface_creation)
+{
+ char const* text = R"(
+ interface I {}
+ contract C {
+ function f() {
+ new I();
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Cannot instantiate an interface.");
+}
+
+BOOST_AUTO_TEST_CASE(accept_library_creation)
+{
+ char const* text = R"(
+ library L {}
+ contract C {
+ function f() {
+ new L();
+ }
+ }
+ )";
+ CHECK_SUCCESS(text);
+}
+
+BOOST_AUTO_TEST_CASE(reject_interface_constructors)
+{
+ char const* text = R"(
+ interface I {}
+ contract C is I(2) {}
+ )";
+ CHECK_ERROR(text, TypeError, "Wrong argument count for constructor call: 1 arguments given but expected 0.");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}