Skip to content

Test runner needs to be able to run unexported tests #721

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

Closed
brson opened this issue Jul 21, 2011 · 1 comment
Closed

Test runner needs to be able to run unexported tests #721

brson opened this issue Jul 21, 2011 · 1 comment
Assignees
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc

Comments

@brson
Copy link
Contributor

brson commented Jul 21, 2011

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]

@ghost ghost assigned brson Jul 21, 2011
@ghost ghost assigned brson Jan 5, 2012
@brson
Copy link
Contributor Author

brson commented Jan 6, 2012

51e6df6

@brson brson closed this as completed Jan 6, 2012
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
Update associated-items.md.  "it"->is
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2020
Bumps [adler32](https://github.com/remram44/adler32-rs) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/remram44/adler32-rs/releases)
- [Commits](remram44/adler32-rs@1.0.3...1.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc
Projects
None yet
Development

No branches or pull requests

1 participant