Discovering the current test (name)

As the author of the skippable test pre-RFC, I think that thread-locals are just about the worst possible solution to this because it means that one has to think differently about APIs such as async, thread::spawn, or just about anything under rayon. We already had issues with println!() and its thread local usage behind the scenes. Let's please not add new ones.

Personally, I think just having either a magic macro or symbol that is available in #[test] functions is suitable. I have crates which like to use the test name and I just pass it around explicitly from the top-level function (Vim's word-in-buffer completion helping out from there).

2 Likes