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 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.Change the syntax entirely; perhaps using function definitions instead:
The downside to this approach is that it's not clear that
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.