mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test(add): Demonstrate version selection for old toolchains
This commit is contained in:
parent
d57b6f2f73
commit
a30652f2d4
@ -123,6 +123,10 @@ mod rust_version_ignore;
|
||||
mod rust_version_incompatible;
|
||||
mod rust_version_latest;
|
||||
mod rust_version_older;
|
||||
mod rustc_ignore;
|
||||
mod rustc_incompatible;
|
||||
mod rustc_latest;
|
||||
mod rustc_older;
|
||||
mod sorted_table_with_dotted_item;
|
||||
mod target;
|
||||
mod target_cfg;
|
||||
|
6
tests/testsuite/cargo_add/rustc_ignore/in/Cargo.toml
Normal file
6
tests/testsuite/cargo_add/rustc_ignore/in/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
38
tests/testsuite/cargo_add/rustc_ignore/mod.rs
Normal file
38
tests/testsuite/cargo_add/rustc_ignore/mod.rs
Normal file
@ -0,0 +1,38 @@
|
||||
use cargo_test_support::compare::assert_ui;
|
||||
use cargo_test_support::current_dir;
|
||||
use cargo_test_support::file;
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::Project;
|
||||
|
||||
#[cargo_test]
|
||||
fn case() {
|
||||
cargo_test_support::registry::init();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.0")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.1")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.2.1")
|
||||
.rust_version("1.2345")
|
||||
.publish();
|
||||
|
||||
let project = Project::from_template(current_dir!().join("in"));
|
||||
let project_root = project.root();
|
||||
let cwd = &project_root;
|
||||
|
||||
snapbox::cmd::Command::cargo_ui()
|
||||
.arg("-Zmsrv-policy")
|
||||
.arg("add")
|
||||
.arg("--ignore-rust-version")
|
||||
.arg_line("rust-version-user")
|
||||
.current_dir(cwd)
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.assert()
|
||||
.code(0)
|
||||
.stdout_matches(str![""])
|
||||
.stderr_matches(file!["stderr.term.svg"]);
|
||||
|
||||
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
|
||||
}
|
9
tests/testsuite/cargo_add/rustc_ignore/out/Cargo.toml
Normal file
9
tests/testsuite/cargo_add/rustc_ignore/out/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
rust-version-user = "0.2.1"
|
29
tests/testsuite/cargo_add/rustc_ignore/stderr.term.svg
Normal file
29
tests/testsuite/cargo_add/rustc_ignore/stderr.term.svg
Normal file
@ -0,0 +1,29 @@
|
||||
<svg width="740px" height="74px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-green { fill: #00AA00 }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan class="fg-green bold"> Adding</tspan><tspan> rust-version-user v0.2.1 to dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 873 B |
@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
31
tests/testsuite/cargo_add/rustc_incompatible/mod.rs
Normal file
31
tests/testsuite/cargo_add/rustc_incompatible/mod.rs
Normal file
@ -0,0 +1,31 @@
|
||||
use cargo_test_support::compare::assert_ui;
|
||||
use cargo_test_support::current_dir;
|
||||
use cargo_test_support::file;
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::Project;
|
||||
|
||||
#[cargo_test]
|
||||
fn case() {
|
||||
cargo_test_support::registry::init();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.2.1")
|
||||
.rust_version("1.2345")
|
||||
.publish();
|
||||
|
||||
let project = Project::from_template(current_dir!().join("in"));
|
||||
let project_root = project.root();
|
||||
let cwd = &project_root;
|
||||
|
||||
snapbox::cmd::Command::cargo_ui()
|
||||
.arg("-Zmsrv-policy")
|
||||
.arg("add")
|
||||
.arg_line("rust-version-user")
|
||||
.current_dir(cwd)
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout_matches(str![""])
|
||||
.stderr_matches(file!["stderr.term.svg"]);
|
||||
|
||||
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
rust-version-user = "0.2.1"
|
29
tests/testsuite/cargo_add/rustc_incompatible/stderr.term.svg
Normal file
29
tests/testsuite/cargo_add/rustc_incompatible/stderr.term.svg
Normal file
@ -0,0 +1,29 @@
|
||||
<svg width="740px" height="74px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-green { fill: #00AA00 }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan class="fg-green bold"> Adding</tspan><tspan> rust-version-user v0.2.1 to dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 873 B |
6
tests/testsuite/cargo_add/rustc_latest/in/Cargo.toml
Normal file
6
tests/testsuite/cargo_add/rustc_latest/in/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
37
tests/testsuite/cargo_add/rustc_latest/mod.rs
Normal file
37
tests/testsuite/cargo_add/rustc_latest/mod.rs
Normal file
@ -0,0 +1,37 @@
|
||||
use cargo_test_support::compare::assert_ui;
|
||||
use cargo_test_support::current_dir;
|
||||
use cargo_test_support::file;
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::Project;
|
||||
|
||||
#[cargo_test]
|
||||
fn case() {
|
||||
cargo_test_support::registry::init();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.0")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.1")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.2.1")
|
||||
.rust_version("1.2345")
|
||||
.publish();
|
||||
|
||||
let project = Project::from_template(current_dir!().join("in"));
|
||||
let project_root = project.root();
|
||||
let cwd = &project_root;
|
||||
|
||||
snapbox::cmd::Command::cargo_ui()
|
||||
.arg("-Zmsrv-policy")
|
||||
.arg("add")
|
||||
.arg_line("rust-version-user")
|
||||
.current_dir(cwd)
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout_matches(str![""])
|
||||
.stderr_matches(file!["stderr.term.svg"]);
|
||||
|
||||
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
|
||||
}
|
9
tests/testsuite/cargo_add/rustc_latest/out/Cargo.toml
Normal file
9
tests/testsuite/cargo_add/rustc_latest/out/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
rust-version-user = "0.2.1"
|
29
tests/testsuite/cargo_add/rustc_latest/stderr.term.svg
Normal file
29
tests/testsuite/cargo_add/rustc_latest/stderr.term.svg
Normal file
@ -0,0 +1,29 @@
|
||||
<svg width="740px" height="74px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-green { fill: #00AA00 }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan class="fg-green bold"> Adding</tspan><tspan> rust-version-user v0.2.1 to dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 873 B |
6
tests/testsuite/cargo_add/rustc_older/in/Cargo.toml
Normal file
6
tests/testsuite/cargo_add/rustc_older/in/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
0
tests/testsuite/cargo_add/rustc_older/in/src/lib.rs
Normal file
0
tests/testsuite/cargo_add/rustc_older/in/src/lib.rs
Normal file
37
tests/testsuite/cargo_add/rustc_older/mod.rs
Normal file
37
tests/testsuite/cargo_add/rustc_older/mod.rs
Normal file
@ -0,0 +1,37 @@
|
||||
use cargo_test_support::compare::assert_ui;
|
||||
use cargo_test_support::current_dir;
|
||||
use cargo_test_support::file;
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::Project;
|
||||
|
||||
#[cargo_test]
|
||||
fn case() {
|
||||
cargo_test_support::registry::init();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.0")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.1.1")
|
||||
.rust_version("1.30")
|
||||
.publish();
|
||||
cargo_test_support::registry::Package::new("rust-version-user", "0.2.1")
|
||||
.rust_version("1.2345")
|
||||
.publish();
|
||||
|
||||
let project = Project::from_template(current_dir!().join("in"));
|
||||
let project_root = project.root();
|
||||
let cwd = &project_root;
|
||||
|
||||
snapbox::cmd::Command::cargo_ui()
|
||||
.arg("-Zmsrv-policy")
|
||||
.arg("add")
|
||||
.arg_line("rust-version-user")
|
||||
.current_dir(cwd)
|
||||
.masquerade_as_nightly_cargo(&["msrv-policy"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout_matches(str![""])
|
||||
.stderr_matches(file!["stderr.term.svg"]);
|
||||
|
||||
assert_ui().subset_matches(current_dir!().join("out"), &project_root);
|
||||
}
|
9
tests/testsuite/cargo_add/rustc_older/out/Cargo.toml
Normal file
9
tests/testsuite/cargo_add/rustc_older/out/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "cargo-list-test-fixture"
|
||||
version = "0.0.0"
|
||||
edition = "2015"
|
||||
|
||||
[dependencies]
|
||||
rust-version-user = "0.2.1"
|
29
tests/testsuite/cargo_add/rustc_older/stderr.term.svg
Normal file
29
tests/testsuite/cargo_add/rustc_older/stderr.term.svg
Normal file
@ -0,0 +1,29 @@
|
||||
<svg width="740px" height="74px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-green { fill: #00AA00 }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-green bold"> Updating</tspan><tspan> `dummy-registry` index</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan class="fg-green bold"> Adding</tspan><tspan> rust-version-user v0.2.1 to dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 873 B |
Loading…
x
Reference in New Issue
Block a user