Exemplo n.º 1
0
        internal void GetTokens_SingleTokenInputs_String(string input, string expectedValue, BQueryTokenKind expectedTokenKind)
        {
            var lexer = new BQueryLexer(new TextSource(input));
            var token = lexer.GetTokens().Single();

            Assert.Equal(expectedTokenKind, token.TokenKind);
            Assert.Equal(expectedValue, token.Value);
        }
Exemplo n.º 2
0
        internal void GetTokens_StringAccess()
        {
            const string input = "['foo']";

            var lexer        = new BQueryLexer(new TextSource(input));
            var actualTokens = lexer.GetTokens().ToArray();

            var expectedTokens = new[] {
                new BQueryToken(BQueryTokenKind.LBracket, "["),
                new BQueryToken(BQueryTokenKind.String, "foo"),
                new BQueryToken(BQueryTokenKind.RBracket, "]"),
            };

            AssertTokens(expectedTokens, actualTokens);
        }
Exemplo n.º 3
0
        internal void GetTokens_MultipleTokensInInput()
        {
            const string input = "foo.bar.array[42].mike";

            var lexer        = new BQueryLexer(new TextSource(input));
            var actualTokens = lexer.GetTokens().ToArray();

            var expectedTokens = new[] {
                new BQueryToken(BQueryTokenKind.Id, "foo"),
                new BQueryToken(BQueryTokenKind.Dot, "."),
                new BQueryToken(BQueryTokenKind.Id, "bar"),
                new BQueryToken(BQueryTokenKind.Dot, "."),
                new BQueryToken(BQueryTokenKind.Id, "array"),
                new BQueryToken(BQueryTokenKind.LBracket, "["),
                new BQueryToken(BQueryTokenKind.Number, "42"),
                new BQueryToken(BQueryTokenKind.RBracket, "]"),
                new BQueryToken(BQueryTokenKind.Dot, "."),
                new BQueryToken(BQueryTokenKind.Id, "mike"),
            };

            AssertTokens(expectedTokens, actualTokens);
        }