public void AnyAllSyntacticParsingShouldNotRecognizeRangeVariablesOutsideOfScope()
        {
            // Repro for: Syntactic parser assumes any token which matches the name of a previously used range variable is also a range variable, even after the scope has been exited
            QueryToken tree = this.testSubject.ParseFilter("Things/any(o:true) and o");

            tree.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And).And.Right.ShouldBeEndPathToken("o");
        }
Ejemplo n.º 2
0
        public void SearchOrTest()
        {
            QueryToken token       = searchParser.ParseSearch("foo OR bar");
            var        binaryToken = token.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.Or);

            binaryToken.Left.ShouldBeStringLiteralToken("foo");
            binaryToken.Right.ShouldBeStringLiteralToken("bar");
        }
Ejemplo n.º 3
0
        public void SearchSpaceInParenthesesImpliesAndTest()
        {
            QueryToken token         = searchParser.ParseSearch("(A BC) DEF");
            var        binaryToken1  = token.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);
            var        binaryToken11 = binaryToken1.Left.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);

            binaryToken11.Left.ShouldBeStringLiteralToken("A");
            binaryToken11.Right.ShouldBeStringLiteralToken("BC");
            binaryToken1.Right.ShouldBeStringLiteralToken("DEF");
        }
Ejemplo n.º 4
0
        public void SearchAndTest()
        {
            QueryToken token         = searchParser.ParseSearch("A AND BC AND DEF");
            var        binaryToken1  = token.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);
            var        binaryToken11 = binaryToken1.Left.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);

            binaryToken11.Left.ShouldBeStringLiteralToken("A");
            binaryToken11.Right.ShouldBeStringLiteralToken("BC");
            binaryToken1.Right.ShouldBeStringLiteralToken("DEF");
        }
Ejemplo n.º 5
0
        public void SearchParenthesesTest()
        {
            QueryToken token         = searchParser.ParseSearch("(A  OR BC) AND DEF");
            var        binaryToken1  = token.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And).And;
            var        binaryToken11 = binaryToken1.Left.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.Or).And;

            binaryToken11.Left.ShouldBeStringLiteralToken("A");
            binaryToken11.Right.ShouldBeStringLiteralToken("BC");
            binaryToken1.Right.ShouldBeStringLiteralToken("DEF");
        }
Ejemplo n.º 6
0
        public void SearchCombinedTest()
        {
            QueryToken token         = searchParser.ParseSearch("a AND bc OR def AND NOT (ghij AND klmno AND pqrstu)");
            var        binaryToken1  = token.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.Or);
            var        binaryToken21 = binaryToken1.Left.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);
            var        binaryToken22 = binaryToken1.Right.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);

            binaryToken21.Left.ShouldBeStringLiteralToken("a");
            binaryToken21.Right.ShouldBeStringLiteralToken("bc");
            binaryToken22.Left.ShouldBeStringLiteralToken("def");
            var unaryToken222   = binaryToken22.Right.ShouldBeUnaryOperatorQueryToken(UnaryOperatorKind.Not);
            var binaryToken222  = unaryToken222.Operand.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);
            var binaryToken2221 = binaryToken222.Left.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.And);

            binaryToken2221.Left.ShouldBeStringLiteralToken("ghij");
            binaryToken2221.Right.ShouldBeStringLiteralToken("klmno");
            binaryToken222.Right.ShouldBeStringLiteralToken("pqrstu");
        }