Browse Source

Actually add the rust side of the test

add-rc-path
Niels Grewe 9 years ago
parent
commit
849423b100
  1. 4
      gcc-test/build.rs
  2. 13
      gcc-test/tests/all.rs

4
gcc-test/build.rs

@ -69,4 +69,8 @@ fn main() {
println!("cargo:rustc-link-lib=msvc");
println!("cargo:rustc-link-search={}", out.display());
}
// This tests whether we can build a library but not link it to the main crate.
// The test module will do its own linking.
gcc::Config::new().link(false).file("src/opt_linkage.c").compile("libOptLinkage.a");
}

13
gcc-test/tests/all.rs

@ -2,6 +2,14 @@ extern crate gcc_test;
use gcc_test::*;
// This will cause a link failure if the archive is already
// linked against the gcc_test crate.
#[link(name = "OptLinkage", kind = "static")]
extern {
fn answer() -> i32;
}
#[test]
fn foo_here() {
unsafe {
@ -46,3 +54,8 @@ fn msvc_here() {
msvc();
}
}
#[test]
fn opt_linkage() {
unsafe { assert_eq!(answer(),42); }
}

Loading…
Cancel
Save