Skip to content
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

Make unnameable tests an error #52917

Closed
djrenren opened this issue Jul 31, 2018 · 1 comment
Closed

Make unnameable tests an error #52917

djrenren opened this issue Jul 31, 2018 · 1 comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@djrenren
Copy link
Contributor

djrenren commented Jul 31, 2018

Right now the compiler will simply allow tests that cannot be run. The following will compile but will not run any tests.

fn foo() {
  #[test]
  fn bar(){}
}

This constitutes a silent failure and should probably be a hard error (or at least a warning). There's a lint for it: UnnameableTestFunctions but it isn't run by default.

@djrenren djrenren changed the title Make unnameable tests an incomptability lint Make unnameable tests an error Jul 31, 2018
@estebank
Copy link
Contributor

In nightly, introduced in #51450:

warning: cannot test inner function
 --> src/main.rs:2:3
  |
2 |   #[test]
  |   ^^^^^^^
  |
  = note: #[warn(unnameable_test_functions)] on by default

It warns by default, it just hasn't landed in stable yet.

@estebank estebank added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

2 participants