Skip to content

Commit 536e3d5

Browse files
committed
test(check): Show current style
1 parent 198cbc3 commit 536e3d5

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

tests/suite/cli_rustup_ui.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::fs::create_dir_all;
22
use std::path::Path;
33

44
use rustup::test::{CliTestContext, Scenario};
5+
use snapbox::cmd::{cargo_bin, Command};
56
use snapbox::Data;
6-
use snapbox::cmd::{Command, cargo_bin};
77

88
#[track_caller]
99
fn test_help(name: &str, args: &[&str]) {
@@ -67,6 +67,50 @@ fn rustup_only_options() {
6767
test_error("rustup_only_options", &["-q"]);
6868
}
6969

70+
#[tokio::test]
71+
async fn rustup_check_updates_none() {
72+
let name = "rustup_check_updates_none";
73+
let cx = CliTestContext::new(Scenario::SimpleV2).await;
74+
cx.config
75+
.expect(["rustup", "toolchain", "add", "stable", "beta", "nightly"])
76+
.await
77+
.is_ok();
78+
cx.config
79+
.expect_with_env(["rustup", "check"], [("RUSTUP_TERM_COLOR", "always")])
80+
.await
81+
.with_stdout(Data::read_from(
82+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stdout.term.svg")),
83+
None,
84+
))
85+
.with_stderr("")
86+
.is_err();
87+
}
88+
89+
#[tokio::test]
90+
async fn rustup_check_updates_some() {
91+
let name = "rustup_check_updates_some";
92+
let mut cx = CliTestContext::new(Scenario::None).await;
93+
94+
{
95+
let cx = cx.with_dist_dir(Scenario::ArchivesV2_2015_01_01);
96+
cx.config
97+
.expect(["rustup", "toolchain", "add", "stable", "beta", "nightly"])
98+
.await
99+
.is_ok();
100+
}
101+
102+
let cx = cx.with_dist_dir(Scenario::SimpleV2);
103+
cx.config
104+
.expect_with_env(["rustup", "check"], [("RUSTUP_TERM_COLOR", "always")])
105+
.await
106+
.with_stdout(Data::read_from(
107+
Path::new(&format!("tests/suite/cli_rustup_ui/{name}.stdout.term.svg")),
108+
None,
109+
))
110+
.with_stderr("")
111+
.is_ok();
112+
}
113+
70114
#[test]
71115
fn rustup_check_cmd_help_flag() {
72116
test_help("rustup_check_cmd_help_flag", &["check", "--help"]);
Lines changed: 29 additions & 0 deletions
Loading
Lines changed: 29 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)