Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unorderedMatches misses cases depending on the ordering of the input #73

Closed
natebosch opened this issue Apr 10, 2018 · 0 comments
Closed

Comments

@natebosch
Copy link
Member

// passes
expect([1, 2], unorderedMatches([greaterThan(0), greaterThan(1)]));

// fails
expect([2, 1], unorderedMatches([greaterThan(0), greaterThan(1)]));
natebosch added a commit that referenced this issue Apr 11, 2018
Fixes #73

Re-implements the unordered matcher using a recursive search assuming
that matchers can matche multiple values in the input rather than a
greedy algorithm which allows a value to "consume" a matcher that is
needed for some other matcher.

User visible differences:
- May match inputs that would have previously been (incorrectly)
  rejected.
- The failure description no longer includes the index of the matcher
  which is unmatched, and all unmatched matchers are printed rather than
  the first.
natebosch added a commit that referenced this issue Apr 11, 2018
Fixes #73

Re-implements the unordered matcher using a recursive search assuming
that matchers can matche multiple values in the input rather than a
greedy algorithm which allows a value to "consume" a matcher that is
needed for some other matcher.

User visible differences:
- May match inputs that would have previously been (incorrectly)
  rejected.
- The failure description no longer includes the index of the matcher
  which is unmatched, and all unmatched matchers are printed rather than
  the first.
natebosch added a commit that referenced this issue Apr 11, 2018
Fixes #73

Re-implements the unordered matcher using a recursive search assuming
that matchers can matche multiple values in the input rather than a
greedy algorithm which allows a value to "consume" a matcher that is
needed for some other matcher.

User visible differences:
- May match inputs that would have previously been (incorrectly)
  rejected.
- The failure description no longer includes the index of the matcher
  which is unmatched, and all unmatched matchers are printed rather than
  the first.
natebosch added a commit that referenced this issue Apr 11, 2018
Fixes #73

Reimplements the unordered matcher using a recursive search assuming
that matchers can match multiple values in the input rather than a
greedy algorithm which allows a matcher to "consume" a value that is
needed for some other matcher.

User visible differences:
- May match inputs that would have previously been (incorrectly)
  rejected.
- The failure description no longer includes the index of the matcher
  which is unmatched, and all unmatched matchers are printed rather than
  the first.
natebosch added a commit that referenced this issue Apr 11, 2018
Fixes #73

Reimplements the unordered matcher using a recursive search assuming
that matchers can match multiple values in the input rather than a
greedy algorithm which allows a matcher to "consume" a value that is
needed for some other matcher.

User visible differences:
- May match inputs that would have previously been (incorrectly)
  rejected.
- The failure description may include a number of unmatched
  expectations if more than 1 is unmatched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant