Skip to content

Commit

Permalink
#146 : UT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
b3b00 committed Jan 2, 2020
1 parent aa1130a commit 21c9bdc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ParserTests/EBNFTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ public string C(Token<OptionTestToken> c)
public class AlternateChoiceTestNonTerminal
{
[Production("choice : [ A | B | C]")]
public string Choice(Token<OptionTestToken> c)
public string Choice(string c)
{
return c.Value;
return c;
}

[Production("C : c")]
Expand Down Expand Up @@ -767,10 +767,13 @@ public void TestAlternateChoiceTerminal()
Assert.False(builtParser.Errors.Any());
var parseResult = builtParser.Result.Parse("a", "choice");
Assert.True(parseResult.IsOk);
Assert.Equal("a",parseResult.Result);
parseResult = builtParser.Result.Parse("b", "choice");
Assert.True(parseResult.IsOk);
parseResult = builtParser.Result.Parse("b", "choice");
Assert.Equal("b",parseResult.Result);
parseResult = builtParser.Result.Parse("c", "choice");
Assert.True(parseResult.IsOk);
Assert.Equal("c",parseResult.Result);
parseResult = builtParser.Result.Parse("d", "choice");
Assert.False(parseResult.IsOk);
}
Expand All @@ -786,10 +789,13 @@ public void TestAlternateChoiceNonTerminal()
Assert.False(builtParser.Errors.Any());
var parseResult = builtParser.Result.Parse("a", "choice");
Assert.True(parseResult.IsOk);
Assert.Equal("A(a)",parseResult.Result);
parseResult = builtParser.Result.Parse("b", "choice");
Assert.True(parseResult.IsOk);
Assert.Equal("B(b)",parseResult.Result);
parseResult = builtParser.Result.Parse("c", "choice");
Assert.True(parseResult.IsOk);
Assert.Equal("C(c)",parseResult.Result);
parseResult = builtParser.Result.Parse("d", "choice");
Assert.False(parseResult.IsOk);
}
Expand Down

0 comments on commit 21c9bdc

Please sign in to comment.