Closed AndrewSav closed 3 years ago
Would it be possible to tack a test on with this one?
@nblumhardt the current Where
does not have a test. IMO, the change is trivial enough, so if the method did not have the test before the change itself does not warrant it now. What do you think?
Thanks for the reply!
Originally, this codebase evolved pretty quickly, and test coverage is lower than it should be. I'm trying to bump it up a little with each change :-)
How about:
public class WhereCombinatorTests
{
[Fact]
public void WhereFailsIfPrecedingParserFails()
{
AssertParser.Fails(Character.EqualTo('a').Where(_ => true), "b");
}
[Fact]
public void WhereSucceedsWhenPredicateMatches()
{
AssertParser.SucceedsWith(Character.EqualTo('a').Where(a => a == 'a'), "a", 'a');
}
[Fact]
public void WhereFailsWhenPredicateDoesNotMatch()
{
AssertParser.FailsWithMessage(
Character.EqualTo('a').Where(a => a != 'a', "character should be an A"),
"a",
"Syntax error (line 1, column 1): character should be an A");
}
}
@nblumhardt thank you for this, I have added it.
Great, thanks 👍
Resolves https://github.com/datalust/superpower/issues/117