mirror of
https://github.com/rust-lang/cargo
synced 2024-10-01 21:43:45 +00:00
Add and move tests for jobs of cargo build
A test when argument is negative is added. In addition, `default_cargo_config_jobs` and `good_cargo_config_jobs` is moved from `testsuite/bad_config.rs` to `testsuite/build.rs` because these tests are not for `bad config`.
This commit is contained in:
parent
5a139f7e6d
commit
4956d3e778
|
@ -162,36 +162,6 @@ invalid value: integer `-1`, expected u32
|
|||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn default_cargo_config_jobs() {
|
||||
let p = project()
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
".cargo/config",
|
||||
r#"
|
||||
[build]
|
||||
jobs = 1
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
p.cargo("build -v").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn good_cargo_config_jobs() {
|
||||
let p = project()
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
".cargo/config",
|
||||
r#"
|
||||
[build]
|
||||
jobs = 4
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
p.cargo("build -v").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn invalid_global_config() {
|
||||
let p = project()
|
||||
|
|
|
@ -4297,6 +4297,36 @@ required by package `bar v0.1.0 ([..]/foo)`
|
|||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn default_cargo_config_jobs() {
|
||||
let p = project()
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
".cargo/config",
|
||||
r#"
|
||||
[build]
|
||||
jobs = 1
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
p.cargo("build -v").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn good_cargo_config_jobs() {
|
||||
let p = project()
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
".cargo/config",
|
||||
r#"
|
||||
[build]
|
||||
jobs = 4
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
p.cargo("build -v").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn invalid_jobs() {
|
||||
let p = project()
|
||||
|
@ -4304,6 +4334,13 @@ fn invalid_jobs() {
|
|||
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
||||
.build();
|
||||
|
||||
p.cargo("build --jobs -1")
|
||||
.with_status(1)
|
||||
.with_stderr_contains(
|
||||
"error: Found argument '-1' which wasn't expected, or isn't valid in this context",
|
||||
)
|
||||
.run();
|
||||
|
||||
p.cargo("build --jobs over9000")
|
||||
.with_status(1)
|
||||
.with_stderr("error: Invalid value: could not parse `over9000` as a number")
|
||||
|
|
Loading…
Reference in a new issue