mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removing events from Solidity Interface
This commit is contained in:
parent
600b38224e
commit
44103be9b0
@ -111,24 +111,6 @@ BOOST_AUTO_TEST_CASE(exclude_fallback_function)
|
|||||||
BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}");
|
BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(event)
|
|
||||||
{
|
|
||||||
ContractDefinition const& contract = checkInterface(
|
|
||||||
"contract test { event Event; }");
|
|
||||||
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
|
|
||||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
|
|
||||||
"event Event;");
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(event_arguments)
|
|
||||||
{
|
|
||||||
ContractDefinition const& contract = checkInterface(
|
|
||||||
"contract test { event Event(uint a, uint indexed b); }");
|
|
||||||
BOOST_REQUIRE_EQUAL(1, contract.getEvents().size());
|
|
||||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getEvents().front()),
|
|
||||||
"event Event(uint256 a,uint256 indexed b);");
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(events)
|
BOOST_AUTO_TEST_CASE(events)
|
||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
@ -137,10 +119,8 @@ BOOST_AUTO_TEST_CASE(events)
|
|||||||
" event e2(); \n"
|
" event e2(); \n"
|
||||||
"}\n";
|
"}\n";
|
||||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||||
set<string> expectation({"event e1(uint256 b,address indexed c);", "event e2;"});
|
// events should not appear in the Solidity Interface
|
||||||
BOOST_REQUIRE_EQUAL(2, contract.getEvents().size());
|
BOOST_REQUIRE_EQUAL(0, contract.getEvents().size());
|
||||||
BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getEvents().at(0)),
|
|
||||||
getSourcePart(*contract.getEvents().at(1))}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(inheritance)
|
BOOST_AUTO_TEST_CASE(inheritance)
|
||||||
@ -155,12 +135,8 @@ BOOST_AUTO_TEST_CASE(inheritance)
|
|||||||
" event derivedEvent(uint indexed evtArgDerived); \n"
|
" event derivedEvent(uint indexed evtArgDerived); \n"
|
||||||
" }";
|
" }";
|
||||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||||
set<string> expectedEvents({"event derivedEvent(uint256 indexed evtArgDerived);",
|
|
||||||
"event baseEvent(string32 indexed evtArgBase);"});
|
|
||||||
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
||||||
"function derivedFunction(string32 p)returns(string32 i){}"});
|
"function derivedFunction(string32 p)returns(string32 i){}"});
|
||||||
BOOST_CHECK(expectedEvents == set<string>({getSourcePart(*contract.getEvents().at(0)),
|
|
||||||
getSourcePart(*contract.getEvents().at(1))}));
|
|
||||||
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
||||||
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
||||||
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
||||||
|
Loading…
Reference in New Issue
Block a user