test(add): Demonstrate version selection for old toolchains

This commit is contained in:
Ed Page 2024-03-01 15:54:46 -06:00
parent d57b6f2f73
commit a30652f2d4
25 changed files with 323 additions and 0 deletions

View File

@ -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;

View File

@ -0,0 +1,6 @@
[workspace]
[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

View 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);
}

View 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"

View 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

View File

@ -0,0 +1,6 @@
[workspace]
[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

View 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);
}

View 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"

View 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

View File

@ -0,0 +1,6 @@
[workspace]
[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

View 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);
}

View 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"

View 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

View File

@ -0,0 +1,6 @@
[workspace]
[package]
name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

View 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);
}

View 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"

View 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