You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current mechanism for subtests simply acts as a series of statements defined in a subtest! { ... } macro. Although this functionally works, it suffers the significant drawback that it is unable to have custom attributes specified -- such as #[should_panic]or#[ignore]`, which are needed for testing.
It's unclear what the best direction forward for this is. A couple thoughts come to mind:
Extend the DSL to support [<attribute>] syntax, e.g. subtest! { |name| [should_panic][ignore] ... }, this is kind of gross -- but would work.
Change the syntax entirely; perhaps using function definitions instead:
The downside to this approach is that it's not clear that vec is within fn out_of_bounds_panics() scope, since this typically is not a true closure. The upside is that this has a clear mechanism for identifying attributes, the test ident, etc.
The exact approach is yet to be determined.
The text was updated successfully, but these errors were encountered:
The existing `subtest!` syntax was a little foreign to work with due
to the custom `|<ident>|` syntax, which feels a little unnatural for
normal rust. This effectively formed a DSL that does not exist in
other parts of the language in any capacity, and it also posed
challenges for things like introducing attributes for subtests, and
even for IDE intellisense to provide better completion-syntax.
As an alternative, a new syntax of `subtest!(<ident>, <block>)` has been
put forward for testing in this change. This drops the custom `|<ident>|`
naming convention in favor of an explicit ident first-argument, followed
by a true `block` input.
Passing a block here will provide better context for parsing and
general intellisense, and enables more room for future-growth for
supporting things like attributes in subtests as defined in #14.
Existing tests/examples have been updated to reflect the new syntax.
The current mechanism for subtests simply acts as a series of statements defined in a
subtest! { ... }
macro. Although this functionally works, it suffers the significant drawback that it is unable to have custom attributes specified -- such as #[should_panic]or
#[ignore]`, which are needed for testing.It's unclear what the best direction forward for this is. A couple thoughts come to mind:
[<attribute>]
syntax, e.g.subtest! { |name| [should_panic][ignore] ... }
, this is kind of gross -- but would work.vec
is withinfn out_of_bounds_panics()
scope, since this typically is not a true closure. The upside is that this has a clear mechanism for identifying attributes, the test ident, etc.The exact approach is yet to be determined.
The text was updated successfully, but these errors were encountered: