Esempio n. 1
0
 public void AllowsANamedFunctionsVisitorApi()
 {
     var ast = Parser.Parse("{ a, b { x }, c }", new ParseOptions
     {
         NoLocation = true,
     });
     var visitor = new NodeTypeVisitor();
     visitor.Visit(ast);
     visitor.Visited.ShouldBeEquivalentTo(ImmutableArray.Create(
         Tuple.Create(true, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"a"),
         Tuple.Create(true, NodeType.Name, (object)"b"),
         Tuple.Create(true, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"x"),
         Tuple.Create(false, NodeType.SelectionSet, (object)null),
         Tuple.Create(true, NodeType.Name, (object)"c"),
         Tuple.Create(false, NodeType.SelectionSet, (object)null)
     ));
 }
Esempio n. 2
0
        public void AllowsANamedFunctionsVisitorApi()
        {
            var ast = Parser.Parse("{ a, b { x }, c }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor = new NodeTypeVisitor();

            visitor.Visit(ast);
            visitor.Visited.ShouldBeEquivalentTo(ImmutableArray.Create(
                                                     Tuple.Create(true, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"a"),
                                                     Tuple.Create(true, NodeType.Name, (object)"b"),
                                                     Tuple.Create(true, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"x"),
                                                     Tuple.Create(false, NodeType.SelectionSet, (object)null),
                                                     Tuple.Create(true, NodeType.Name, (object)"c"),
                                                     Tuple.Create(false, NodeType.SelectionSet, (object)null)
                                                     ));
        }