diff options
author | LianaHus <liana@ethdev.com> | 2015-09-10 20:26:34 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-10 20:26:34 +0800 |
commit | 845bcf8db09c536c157a7575981daa42b6e6e938 (patch) | |
tree | 07557b43dc18366d3ce9be99c6d63737b4864437 /test | |
parent | 3fc2561223c989885e1473cb29394bb07a26492f (diff) | |
download | dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar.gz dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar.bz2 dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar.lz dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar.xz dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.tar.zst dexon-solidity-845bcf8db09c536c157a7575981daa42b6e6e938.zip |
- added tests to test empty comment
- fixed skipSingleLineComment
- some style fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNatspecJSON.cpp | 16 | ||||
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 10 | ||||
-rw-r--r-- | test/libsolidity/SolidityScanner.cpp | 10 |
3 files changed, 36 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 8a133f5f..5d20fe7b 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -527,6 +527,22 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag) checkNatspec(sourceCode, natspec, true); } +BOOST_AUTO_TEST_CASE(empty_comment) +{ + char const* sourceCode = R"( + // + contract test + {} + )"; + char const* natspec = R"ABCDEF( + { + "methods" : {} + } + )ABCDEF"; + + checkNatspec(sourceCode, natspec, true); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 3cb5aa4b..14b9e9e4 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -914,6 +914,16 @@ BOOST_AUTO_TEST_CASE(location_specifiers_with_var) BOOST_CHECK_THROW(parseText(text), ParserError); } +BOOST_AUTO_TEST_CASE(empty_comment) +{ + char const* text = R"( + // + contract test + {} + )"; + BOOST_CHECK_NO_THROW(parseText(text)); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 431f233e..dadcd903 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -281,6 +281,16 @@ BOOST_AUTO_TEST_CASE(time_after) BOOST_CHECK_EQUAL(scanner.currentToken(), Token::After); } +BOOST_AUTO_TEST_CASE(empty_comment) +{ + Scanner scanner(CharStream("//\ncontract{}")); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Contract); + BOOST_CHECK_EQUAL(scanner.next(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::RBrace); + +} + BOOST_AUTO_TEST_SUITE_END() } |