Lexical analyzer should now be less confused by dots and comma's and an assortment of other single character symbols.
This commit is contained in:
parent
44326da564
commit
914d2fe9fa
3 changed files with 85 additions and 12 deletions
|
|
@ -36,6 +36,32 @@ TEST(SqlLexer, lexer_quote_in_string)
|
|||
ASSERT_THAT(tokentype, Eq(BasicTokenType::QuotedString));
|
||||
}
|
||||
|
||||
TEST(SqlLexer, lexer_comma_handling)
|
||||
{
|
||||
QString input = "abc,def";
|
||||
SqlLexer lexer(input, LexerState::Null);
|
||||
|
||||
int startpos, length;
|
||||
BasicTokenType tokentype;
|
||||
QString out;
|
||||
|
||||
lexer.nextBasicToken(startpos, length, tokentype, out);
|
||||
ASSERT_THAT(startpos, Eq(0));
|
||||
ASSERT_THAT(length, Eq(3));
|
||||
ASSERT_THAT(tokentype, Eq(BasicTokenType::Symbol));
|
||||
|
||||
lexer.nextBasicToken(startpos, length, tokentype, out);
|
||||
ASSERT_THAT(startpos, Eq(3));
|
||||
ASSERT_THAT(length, Eq(1));
|
||||
ASSERT_THAT(tokentype, Eq(BasicTokenType::Self));
|
||||
ASSERT_THAT(out, Eq(QString(",")));
|
||||
|
||||
lexer.nextBasicToken(startpos, length, tokentype, out);
|
||||
ASSERT_THAT(startpos, Eq(4));
|
||||
ASSERT_THAT(length, Eq(3));
|
||||
ASSERT_THAT(tokentype, Eq(BasicTokenType::Symbol));
|
||||
}
|
||||
|
||||
TEST(SqlLexer, lexer_cast)
|
||||
{
|
||||
QString input = "'1'::integer";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue