-
Notifications
You must be signed in to change notification settings - Fork 108
Allow using 'withKnownIssue' as a test or suite trait #1132
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
Comments
I imagine we'd just implement this as a trait, not introduce a new argument. @stmontgomery Do you recall offhand why we didn't do this originally? Were we just waiting for scoping? |
Thanks for filing @AnthonyLatsis! This has indeed come up before, but nobody had yet filed an issue to track the idea. I agree it would be best structured as a trait. I vaguely recall one reason we didn't originally implement |
@Test
without wrapping the entire body in a closure
My gut says we'd be okay limiting this to a blanket But that's probably a question for the eventual review thread. |
Was the idea for the trait’s closure to accept a generic input? I think the trait variant would work best by optionally accepting a list of inputs that are expected to fail, whereas the purpose of |
It is not possible to infer type information for a trait's arguments/etc. based on the type of the function to which the |
The same stands for the |
That's a fair question. The difference there is that we can do type-checking on the arguments to @Test(arguments: 0 ... 10)
func foo(arg: String) { ... } Because the type checker will notice that Traits don't participate in macro expansion in the same way, so there's no way to statically enforce that the arguments to a function-as-trait are of the correct type. Consider: @Test(.xfail([1, 2, 3]), arguments: ["a", "b", "c"])
func foo(arg: String) { ... } There is no static way to intersect |
Uh oh!
There was an error while loading. Please reload this page.
Motivation
withKnownIssue
provides granularity, but does not offer a great user experience when the intent is to express an expected failure of a test function because it requires you to modify the entire body, resulting in (much) larger changes/diffs than necessary.Proposed solution
E.g. a new defaulted parameter for the
Test
macros. Could simply be a boolean; a more prudent design, I believe, would be to have it accept an enum along the lines ofAlternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: