-
Notifications
You must be signed in to change notification settings - Fork 169
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
Add more sequence expression tests. #175
Conversation
We have no unit tests right now for these expression tests. Maybe I should just bite the bullet and write all of them? @boulter ? |
Ok @boulter tests are added for these new expression tests. |
|
||
@Override | ||
public String getName() { | ||
return "containingall"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"containsall"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make grammatical sense. The syntax is if val is expTest val2
. So that would be if val is containsall val2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whereas is containing
, is containingall
, and is within
are the best verbs I have thought of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could reserve the keyword does
and do if val1 does contain val2
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that seems like overkill.
Right now it is difficult to use
selectattr
orif val is
for set functions. This adds three new expression tests:containing
,containingall
, andwithin
.containing
: if the sequence contains an element.if [1, 2, 3] is containing 2)
.containingall
, if the sequence contains all elements of another sequence.if [1, 2, 3] is containingall [1, 2]
.within
: if a value is in a sequence of elements.if 1 is within [1, 2, 3])
.