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

unit testing improperly ignores test funs that take args #4391

Closed
jbclements opened this Issue Jan 9, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@jbclements
Contributor

jbclements commented Jan 9, 2013

First bug report submitted using github: apologies in advance for any #githubfail :

It appears to me that the unit testing framework silently ignores functions marked #[test] that accept an argument.

Here's the file:

extern mod std;

#[test]
fn boozle(t :int) -> int {
  return 9;
}

fn main() {
  io::println("abc");
}

here's the transcript of running this:

jclements-09740:tmp clements$ rustc --test ./badtest.rs -o badtest
./badtest.rs:4:10: 4:13 warning: unused variable: `t`
./badtest.rs:4 fn boozle(t :int) -> int {
                         ^~~
warning: no debug symbols in executable (-arch x86_64)
jclements-09740:tmp clements$ ./badtest

running 0 tests

result: ok. 0 passed; 0 failed; 0 ignored

jclements-09740:tmp clements$ 

I would have expected either a compile-time error or a failed test. A compile-time error, really.

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix Apr 29, 2013

Member

Indeed; we are already issuing a fatal error when someone tries to insert an unsafe function, so other kinds of mismatches seem plausible to me. I think all of the relevant code here is contained within librustc/front/test.rs

Member

pnkfelix commented Apr 29, 2013

Indeed; we are already issuing a fatal error when someone tries to insert an unsafe function, so other kinds of mismatches seem plausible to me. I think all of the relevant code here is contained within librustc/front/test.rs

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

graydon May 1, 2013

Contributor

just a bug, de-milestoning.

Contributor

graydon commented May 1, 2013

just a bug, de-milestoning.

bors added a commit that referenced this issue May 2, 2013

auto merge of #6111 : pnkfelix/rust/issue4391-rustc-should-not-silent…
…ly-skip-erroneous-tests, r=pnkfelix

...e.

Fixes #4391.
@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix May 2, 2013

Member

Fixed by SHA: d1f7220 and its parents (namely SHA: 5f1a90e )

Member

pnkfelix commented May 2, 2013

Fixed by SHA: d1f7220 and its parents (namely SHA: 5f1a90e )

@pnkfelix pnkfelix closed this May 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment