Beispiel #1
0
        public void AllowsForEditingOnLeave()
        {
            var ast = Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor   = new AllowsForEditingOnLeaveStackWalker();
            var editedAst = visitor.Visit(ast);

            ast.ShouldBeEquivalentToDeepDynamic(Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            }));

            var expectation = Parser.Parse("{ a,    c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });

            editedAst.ShouldBeEquivalentToDeepDynamic(expectation);

            var noexpectation = Parser.Parse("{ a, b, c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            Action action = () =>
                            ast.ShouldBeEquivalentToDeepDynamic(noexpectation);

            action.ShouldThrow <Exception>();
        }
Beispiel #2
0
        public void AllowsForEditingOnLeave()
        {
            var ast = Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor = new AllowsForEditingOnLeaveStackWalker();
            var editedAst = visitor.Visit(ast);

            ast.ShouldBeEquivalentToDeepDynamic(Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            }));

            var expectation = Parser.Parse("{ a,    c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            editedAst.ShouldBeEquivalentToDeepDynamic(expectation);

            var noexpectation = Parser.Parse("{ a, b, c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            Action action = () =>
                ast.ShouldBeEquivalentToDeepDynamic(noexpectation);
            action.ShouldThrow<Exception>();
        }