Skip to content

unit testing improperly ignores test funs that take args #4391

Closed
@jbclements

Description

@jbclements

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions