-
Notifications
You must be signed in to change notification settings - Fork 88
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 ConditionTrait.evaluate() #909
base: main
Are you sure you want to change the base?
Conversation
I'm trying to decide what tests to add. Are existing tests enough, since I pretty much just moved existing logic to a different place? |
We aim for 100% code coverage when testing, so the new function should be tested (even if it is just a trivial "did this return true when I expected it to?" test.) |
var commentOverride: Comment? | ||
|
||
|
||
/// Returns the result of evaluating the condition. |
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.
/// Returns the result of evaluating the condition. | |
/// Evaluate this instance's underlying condition. | |
/// | |
/// - Returns: The result of evaluating this instance's underlying condition. | |
/// |
You may also want to include a discussion paragraph after - Returns:
if there is additional information for the reader to consume. In particular, it may be worth noting that the result of this function is not cached.
I plan to add some tests soon, at which point I think it will be appropriate to take the PR out of draft mode. |
Add
ConditionTrait.evaluate()
so that a condition can be evaluated independent of aTest
object.Motivation:
Currently, the only way a
ConditionTrait
is evaluated is inside theprepare(for:)
method. This makes it difficult and awkward for third-party libraries to utilize these traits because evaluating a condition would require creating a dummyTest
to pass to that method.Modifications:
Add
ConditionTrait.evaluate()
, andConditionTrait.Evaluation
enum for the return value.Result:
Public API allows for evaluating a
ConditionTrait
in any context.Checklist: