Пример #1
0
 public void When_the_token_doesnt_match()
 {
     var input = new[] { 1 }.AsInput();
     var parser = new TokenMatchParser<int>(2);
     var result = parser.Parse(input);
     ParseResultAssert.IsFailure(result, new[] { 2 });
 }
Пример #2
0
 public void When_at_the_end_of_input()
 {
     var input = new int[0].AsInput();
     var parser = new TokenMatchParser<int>(1);
     var result = parser.Parse(input);
     ParseResultAssert.IsFailure(result);
 }
Пример #3
0
 public void When_the_token_matches()
 {
     var input = new[] { 1 }.AsInput();
     var parser = new TokenMatchParser<int>(1);
     var result = parser.Parse(input);
     ParseResultAssert.IsSuccess(result);
     ParseResultAssert.AreEqual(1, result);
 }