diff options
author | Michal 'vorner' Vaner <michal.vaner@nic.cz> | 2012-11-22 11:07:03 +0100 |
---|---|---|
committer | Michal 'vorner' Vaner <michal.vaner@nic.cz> | 2012-11-22 11:07:03 +0100 |
commit | 0c0888ef6aeb481f70d424766d7500f869899027 (patch) | |
tree | aa8ad4843f5f9f236217149a59673d4fec1b0f11 /src/lib/dns/tests/master_lexer_unittest.cc | |
parent | [2375] grammar/typo fixes in comments/doc (diff) | |
download | kea-0c0888ef6aeb481f70d424766d7500f869899027.tar.xz kea-0c0888ef6aeb481f70d424766d7500f869899027.zip |
[2375] Remove exception handling from getNextToken
It was deemed unneeded and is removed therefore, to make the code
smaller.
Diffstat (limited to 'src/lib/dns/tests/master_lexer_unittest.cc')
-rw-r--r-- | src/lib/dns/tests/master_lexer_unittest.cc | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/lib/dns/tests/master_lexer_unittest.cc b/src/lib/dns/tests/master_lexer_unittest.cc index 78263c494e..9f5deb9e29 100644 --- a/src/lib/dns/tests/master_lexer_unittest.cc +++ b/src/lib/dns/tests/master_lexer_unittest.cc @@ -393,38 +393,4 @@ TEST_F(MasterLexerTest, ungetAfterSwitch) { EXPECT_THROW(lexer.ungetToken(), isc::InvalidOperation); } -class TestException {}; - -void -doThrow(const std::string&) { - throw TestException(); -} - -// Check the getNextToken provides at least the weak exception guarantee. -TEST_F(MasterLexerTest, getTokenExceptions) { - ss << "\n12345"; - lexer.pushSource(ss); - - // Prepare a chain that changes the internal state, reads something. - // The next item in the chain will throw an exception (we explicitly - // throw something not known to it, so we know it can handle anything). - // Then the thing should get to the previous state and getting the - // token the usual way without mock should work. - const bool true_value = true; - boost::scoped_ptr<State> s2(State::getFakeState(NULL, 3, NULL, 0, NULL, - &doThrow)); - boost::scoped_ptr<State> s1(State::getFakeState(s2.get(), 3, NULL, 1, - &true_value)); - lexer.pushFakeStart(s1.get()); - - // Getting the token with the fake start should throw. But then, the - // current state should be untouched. - EXPECT_THROW(lexer.getNextToken(), TestException); - EXPECT_EQ(0, s1->getParenCount(lexer)); - EXPECT_FALSE(s1->wasLastEOL(lexer)); - - // It gets back to the original state, so getting the newline works. - EXPECT_EQ(MasterLexer::Token::END_OF_LINE, lexer.getNextToken().getType()); -} - } |