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

Specialized string predicates #25

Closed
4 tasks
epage opened this issue Apr 7, 2018 · 3 comments · Fixed by #35
Closed
4 tasks

Specialized string predicates #25

epage opened this issue Apr 7, 2018 · 3 comments · Fixed by #35
Labels
enhancement Improve the expected
Milestone

Comments

@epage
Copy link
Contributor

epage commented Apr 7, 2018

@epage epage added the enhancement Improve the expected label Apr 7, 2018
@epage
Copy link
Contributor Author

epage commented Apr 7, 2018

contains will be needed by assert_cli to maintain feature parity.

@epage
Copy link
Contributor Author

epage commented Apr 7, 2018

Some of these take Pattern. but there isn't an owned version of that trait. We'll probably have to take Into<String> and not be able to handle custom Pattern implementations :(

@epage
Copy link
Contributor Author

epage commented Apr 7, 2018

RE is_empty

We either hard code versions of this for each concrete type we care about or implement an empty-check trait and include implementations for the standard lib.

@epage epage added this to the 0.4 milestone Apr 27, 2018
epage added a commit to epage/predicates-rs that referenced this issue May 10, 2018
Including
- starts_with
- ends_with
- contains

Unfortunately, we can't take pattern, so we're limited to
`Into<String>`.

The only thing missing to complete assert-rs#25 is to add a `count` to
`contains`.  This would either be a number or a numeric predicate.
epage added a commit to epage/predicates-rs that referenced this issue May 10, 2018
This sets a required count for number of matches.

It could be of value to make this accept a predicate.  In that case, for
API convinience, we should probably have a `ToCountPredicate` that is
attached to both `Predicate<usize>` and `usize`.  This would allow
things like `contains("Two").count(predicate::in_iter([3, 4])`.

Fixes assert-rs#25
@epage epage closed this as completed in #35 May 10, 2018
epage added a commit to epage/predicates-rs that referenced this issue May 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant