Browse Source

extra comments scanning test

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
06e2c08af7
  1. 2
      libsolidity/Scanner.h
  2. 11
      test/solidityScanner.cpp

2
libsolidity/Scanner.h

@ -118,7 +118,7 @@ public:
/// Returns the next token and advances input. If called from reset()
/// and ScanToken() found a documentation token then next should be called
/// with _change_skipped_comment=true
/// with _changeSkippedComment=true
Token::Value next(bool _changeSkippedComment = false);
///@{

11
test/solidityScanner.cpp

@ -174,6 +174,7 @@ BOOST_AUTO_TEST_CASE(comment_before_eos)
{
Scanner scanner(CharStream("//"));
BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS);
BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "");
}
BOOST_AUTO_TEST_CASE(documentation_comment_before_eos)
@ -183,6 +184,16 @@ BOOST_AUTO_TEST_CASE(documentation_comment_before_eos)
BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "");
}
BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence)
{
Scanner scanner(CharStream("hello_world ///documentation comment \n"
"//simple comment \n"
"<<"));
BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::IDENTIFIER);
BOOST_CHECK_EQUAL(scanner.next(), Token::SHL);
BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "documentation comment ");
}
BOOST_AUTO_TEST_SUITE_END()
}

Loading…
Cancel
Save