-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for existence for dep-info output in simple compilation cases. Deletes the dep-info file if it fails (for example, if it can't find one of the dep-info inputs).
- Loading branch information
Showing
2 changed files
with
107 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
extern crate cargotest; | ||
extern crate hamcrest; | ||
|
||
use cargotest::support::{basic_bin_manifest, main_file, execs, project}; | ||
use hamcrest::{assert_that, existing_file}; | ||
|
||
#[test] | ||
fn build_dep_info() { | ||
let p = project("foo") | ||
.file("Cargo.toml", &basic_bin_manifest("foo")) | ||
.file("src/foo.rs", &main_file(r#""i am foo""#, &[])); | ||
|
||
assert_that(p.cargo_process("build"), execs().with_status(0)); | ||
|
||
let depinfo_bin_path = &p.bin("foo").with_extension("d"); | ||
|
||
assert_that(depinfo_bin_path, existing_file()); | ||
} | ||
|
||
#[test] | ||
fn build_dep_info_lib() { | ||
let p = project("foo") | ||
.file("Cargo.toml", r#" | ||
[package] | ||
name = "foo" | ||
version = "0.0.1" | ||
authors = [] | ||
[[example]] | ||
name = "ex" | ||
crate-type = ["lib"] | ||
"#) | ||
.file("src/lib.rs", "") | ||
.file("examples/ex.rs", ""); | ||
|
||
assert_that(p.cargo_process("build").arg("--example=ex"), execs().with_status(0)); | ||
assert_that(&p.example_lib("ex", "lib").with_extension("d"), existing_file()); | ||
} | ||
|
||
|
||
#[test] | ||
fn build_dep_info_rlib() { | ||
let p = project("foo") | ||
.file("Cargo.toml", r#" | ||
[package] | ||
name = "foo" | ||
version = "0.0.1" | ||
authors = [] | ||
[[example]] | ||
name = "ex" | ||
crate-type = ["rlib"] | ||
"#) | ||
.file("src/lib.rs", "") | ||
.file("examples/ex.rs", ""); | ||
|
||
assert_that(p.cargo_process("build").arg("--example=ex"), execs().with_status(0)); | ||
assert_that(&p.example_lib("ex", "rlib").with_extension("d"), existing_file()); | ||
} | ||
|
||
#[test] | ||
fn build_dep_info_dylib() { | ||
let p = project("foo") | ||
.file("Cargo.toml", r#" | ||
[package] | ||
name = "foo" | ||
version = "0.0.1" | ||
authors = [] | ||
[[example]] | ||
name = "ex" | ||
crate-type = ["dylib"] | ||
"#) | ||
.file("src/lib.rs", "") | ||
.file("examples/ex.rs", ""); | ||
|
||
assert_that(p.cargo_process("build").arg("--example=ex"), execs().with_status(0)); | ||
assert_that(&p.example_lib("ex", "dylib").with_extension("d"), existing_file()); | ||
} |