Skip to content

Commit 02c7834

Browse files
epagerami3l
authored andcommitted
test: Cover different show_channel_update cases
1 parent 378655c commit 02c7834

7 files changed

+263
-0
lines changed

tests/suite/cli_rustup_ui.rs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,27 @@ fn rustup_component_cmd_remove_cmd_help_flag() {
153153
);
154154
}
155155

156+
#[tokio::test]
157+
async fn rustup_default() {
158+
let name = "rustup_default";
159+
let cx = CliTestContext::new(Scenario::SimpleV2).await;
160+
cx.config
161+
.expect_with_env(
162+
["rustup", "default", "nightly"],
163+
[("RUSTUP_TERM_COLOR", "always")],
164+
)
165+
.await
166+
.with_stdout(Data::read_from(
167+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stdout.term.svg")),
168+
None,
169+
))
170+
.with_stderr(Data::read_from(
171+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stderr.term.svg")),
172+
None,
173+
))
174+
.is_ok();
175+
}
176+
156177
#[test]
157178
fn rustup_default_cmd_help_flag() {
158179
test_help("rustup_default_cmd_help_flag", &["default", "--help"]);
@@ -405,6 +426,56 @@ fn rustup_up_cmd_help_flag() {
405426
test_help("rustup_up_cmd_help_flag", &["up", "--help"]);
406427
}
407428

429+
#[tokio::test]
430+
async fn rustup_update_no_change() {
431+
let name = "rustup_update_no_change";
432+
let cx = CliTestContext::new(Scenario::ArchivesV2_2015_01_01).await;
433+
cx.config
434+
.expect(["rustup", "update", "stable"])
435+
.await
436+
.is_ok();
437+
cx.config
438+
.expect_with_env(["rustup", "update"], [("RUSTUP_TERM_COLOR", "always")])
439+
.await
440+
.with_stdout(Data::read_from(
441+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stdout.term.svg")),
442+
None,
443+
))
444+
.with_stderr(Data::read_from(
445+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stderr.term.svg")),
446+
None,
447+
))
448+
.is_ok();
449+
}
450+
451+
#[tokio::test]
452+
async fn rustup_update_updated() {
453+
let name = "rustup_update_updated";
454+
let mut cx = CliTestContext::new(Scenario::None).await;
455+
456+
{
457+
let cx = cx.with_dist_dir(Scenario::ArchivesV2_2015_01_01);
458+
cx.config
459+
.expect(["rustup", "toolchain", "add", "stable"])
460+
.await
461+
.is_ok();
462+
}
463+
464+
let cx = cx.with_dist_dir(Scenario::SimpleV2);
465+
cx.config
466+
.expect_with_env(["rustup", "update"], [("RUSTUP_TERM_COLOR", "always")])
467+
.await
468+
.with_stdout(Data::read_from(
469+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stdout.term.svg")),
470+
None,
471+
))
472+
.with_stderr(Data::read_from(
473+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stderr.term.svg")),
474+
None,
475+
))
476+
.is_ok();
477+
}
478+
408479
#[test]
409480
fn rustup_update_cmd_help_flag() {
410481
test_help("rustup_update_cmd_help_flag", &["update", "--help"]);
Lines changed: 32 additions & 0 deletions
Loading
Lines changed: 31 additions & 0 deletions
Loading
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 30 additions & 0 deletions
Loading
Lines changed: 40 additions & 0 deletions
Loading
Lines changed: 31 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)