[rust-dev] crate_type = "lib" and testing

Alexander Stavonin a.stavonin at gmail.com
Tue Apr 10 20:07:03 PDT 2012

Hi all,

I've faced with strange behavior of #[test] command. Could someone explain me is it bug or feature.

--------- test.rc ----------
#[link (name="test",
        vers = "0.1",
        uuid = "B019C86D-C7ED-4263-810E-B12A33E6954C")];
#[crate_type = "lib"];

use std;
mod test;
------ END -------

--------- test.rs ----------
fn foo() -> bool { ret true }

fn foo_test() {
    assert foo() == true;
------ END -------

Compiling and run it:

astavonin:/Users/../RustTests: rustc --test test.rc 
warning: no debug symbols in executable (-arch x86_64)
astavonin:/Users/../RustTests: ./test 

running 2 tests
test foo_test ... ok
test test::foo_test ... ok

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

Question: Why 2 tests was created from just 1 foo_test() test function? Also, it's looks like both tests are running parallel and sometimes it provoke segmentation faults in case of more complex tests.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120411/22e77459/attachment.html>

More information about the Rust-dev mailing list