From ad010f557bc4af683688aef423e7ae68d0fd4d08 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 16 Feb 2018 17:32:54 +0100 Subject: [PATCH] Tests for warnings. --- .../SolidityNameAndTypeResolution.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index ce80ffda2..27761066e 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -7818,6 +7818,29 @@ BOOST_AUTO_TEST_CASE(emit_events) CHECK_SUCCESS_NO_WARNINGS(text); } +BOOST_AUTO_TEST_CASE(old_style_events_050) +{ + char const* text = R"( + contract C { + event e(); + function f() public { + e(); + } + } + )"; + CHECK_WARNING(text, "without \"emit\" prefix"); + text = R"( + pragma experimental "v0.5.0"; + contract C { + event e(); + function f() public { + e(); + } + } + )"; + CHECK_ERROR(text, TypeError, "have to be prefixed"); +} + BOOST_AUTO_TEST_SUITE_END() }