Skip to content

Commit 189f139

Browse files
committed
added tests
1 parent 63da894 commit 189f139

File tree

7 files changed

+265
-64
lines changed

7 files changed

+265
-64
lines changed

src/GoatQuery/src/Lexer/Lexer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public Token NextToken()
4848
case ')':
4949
token = new Token(TokenType.RPAREN, _character);
5050
break;
51+
case '/':
52+
token = new Token(TokenType.SLASH, _character);
53+
break;
5154
case '\'':
5255
token.Type = TokenType.STRING;
5356
token.Literal = ReadString();

src/GoatQuery/src/Token/Token.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public enum TokenType
1515
BOOLEAN,
1616
LPAREN,
1717
RPAREN,
18+
SLASH
1819
}
1920

2021
public static class Keywords

src/GoatQuery/tests/Filter/FilterLexerTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,19 @@ public static IEnumerable<object[]> Parameters()
437437
new (TokenType.NULL, "null"),
438438
}
439439
};
440+
441+
yield return new object[]
442+
{
443+
"manager/firstName eq 'James'",
444+
new KeyValuePair<TokenType, string>[]
445+
{
446+
new (TokenType.IDENT, "manager"),
447+
new (TokenType.SLASH, "/"),
448+
new (TokenType.IDENT, "firstName"),
449+
new (TokenType.IDENT, "eq"),
450+
new (TokenType.STRING, "James"),
451+
}
452+
};
440453
}
441454

442455
[Theory]

src/GoatQuery/tests/Filter/FilterParserTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public sealed class FilterParserTest
2525
[InlineData("balance eq null", "balance", "eq", "null")]
2626
[InlineData("balance ne null", "balance", "ne", "null")]
2727
[InlineData("name eq NULL", "name", "eq", "NULL")]
28+
[InlineData("manager/firstName eq 'John'", "manager/firstName", "eq", "John")]
2829
public void Test_ParsingFilterStatement(string input, string expectedLeft, string expectedOperator, string expectedRight)
2930
{
3031
var lexer = new QueryLexer(input);

0 commit comments

Comments
 (0)