23 lines
541 B
Rust
23 lines
541 B
Rust
//! An executable and tests that run only inside the world.
|
|
unsafe extern "C" {
|
|
fn c_add(a: i32, b: i32) -> i32;
|
|
}
|
|
fn main() {
|
|
if std::env::args().any(|arg| arg == "--exit") {
|
|
std::process::exit(23);
|
|
}
|
|
assert_eq!(unsafe { c_add(20, 22) }, 42);
|
|
println!(
|
|
"builder fixture cwd: {}",
|
|
std::env::current_dir().unwrap().display()
|
|
);
|
|
}
|
|
#[test]
|
|
fn pass() {
|
|
assert_eq!(std::env::current_dir().unwrap().to_str(), Some("/project"));
|
|
}
|
|
#[test]
|
|
fn fail() {
|
|
panic!("intentional fixture failure");
|
|
}
|