public void NestedRule() { var content = @" # Header comment Rule 'Rule1' { } "; var scriptAst = ScriptBlock.Create(content).Ast; var visitor = new RuleLanguageAst(null); scriptAst.Visit(visitor); Assert.Null(visitor.Errors); content = @" # Header comment Rule 'Rule1' { Rule 'Rule2' { } } "; scriptAst = ScriptBlock.Create(content).Ast; visitor = new RuleLanguageAst(null); scriptAst.Visit(visitor); Assert.Single(visitor.Errors); }
public void UnvalidRule() { var content = @" Rule '' { } Rule { } Rule 'Rule1'; Rule '' { } Rule 'Rule2' { } Rule -Name 'Rule3' { } Rule -Name 'Rule3' -Body { } "; var scriptAst = ScriptBlock.Create(content).Ast; var visitor = new RuleLanguageAst(null); scriptAst.Visit(visitor); Assert.NotNull(visitor.Errors); Assert.Equal(4, visitor.Errors.Count); }