public void union_parser_with_failing_left_side_and_failing_right_side_fails() { var subject = new Union(__wally__, __dr_jones__); var result = subject.TryMatch(scanner); Assert.That(result.Success, Is.False); }
public void union_parser_with_passing_left_and_passing_right_side_passes_using_longest_match() { var subject = new Union(__this__, __this_is__); var result = subject.TryMatch(scanner); Assert.That(result.Success, Is.True); Assert.That(result.Value, Is.EqualTo("this is")); }
public void uses_parse_method_of_child_parsers() { var parser = Substitute.For<IMatchingParser>(); parser.TryMatch(scanner).Returns(scanner.NoMatch); parser.Parse(scanner).Returns(scanner.NoMatch); var subject = new Union(parser, parser); subject.TryMatch(scanner); parser.Received().Parse(scanner); parser.DidNotReceive().TryMatch(scanner); }