testtokenize: Added TestTokenize::match1 that makes sure the old

matching of "|" and "||" still works
This commit is contained in:
Daniel Marjamäki 2008-12-06 12:54:40 +00:00
parent d307b999e0
commit 4c92c8e6e7
1 changed files with 32 additions and 1 deletions

View File

@ -48,7 +48,9 @@ private:
TEST_CASE( numeric_true_condition );
TEST_CASE( multi_compare );
TEST_CASE( multi_compare );
TEST_CASE( match1 );
}
@ -227,6 +229,35 @@ private:
ASSERT_EQUALS( TOKEN::multiCompare( "one|two", "notfound" ), -1 );
ASSERT_EQUALS( TOKEN::multiCompare( "verybig|two", "s" ), -1 );
ASSERT_EQUALS( TOKEN::multiCompare( "one|two", "ne" ), -1 );
}
void match1()
{
// Match "%var% | %var%"
{
const std::string code("abc|def");
// tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
// Match..
ASSERT_EQUALS( true, TOKEN::Match(tokenizer.tokens(), "%var% | %var%") );
}
// Match "%var% || %var%"
{
const std::string code("abc||def");
// tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
// Match..
ASSERT_EQUALS( true, TOKEN::Match(tokenizer.tokens(), "%var% || %var%") );
}
}
};