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
Currently, tests have to be visible at the top level of the crate to be run, observing the normal rules for item visibility. In Rust we can have layers and layers of unexported modules - modules that still need to be tested. There are a few ways to allow these to be tested:
With reexporting we could require the user to bubble up their tests to the top level
With reexporting we could possibly have the test runner fold generate exports to do the same
We could cheat, which is what I want to do
The test runner generates a method that looks like this
__tests() -> test_desc[] {
... build a vector of test functions ...
}
I want to add a secret attribute to __tests, #[__resolve_unexported], that tells the resolve pass to follow paths regardless of whether the item is exported, allowing this one function to look into the bowels of the crate.
To prevent abuse we could even give the attribute an unparsable ident, like #[!resolve_unexported]
The text was updated successfully, but these errors were encountered:
Currently, tests have to be visible at the top level of the crate to be run, observing the normal rules for item visibility. In Rust we can have layers and layers of unexported modules - modules that still need to be tested. There are a few ways to allow these to be tested:
The test runner generates a method that looks like this
I want to add a secret attribute to __tests,
#[__resolve_unexported]
, that tells the resolve pass to follow paths regardless of whether the item is exported, allowing this one function to look into the bowels of the crate.To prevent abuse we could even give the attribute an unparsable ident, like
#[!resolve_unexported]
The text was updated successfully, but these errors were encountered: