Skip to content

Commit 72a95f6

Browse files
committed
test: add tests for rustup toolchain install --no-update
1 parent bb4d4ed commit 72a95f6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/suite/cli_rustup.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,57 @@ info: it's active because: overridden by '[TOOLCHAIN_FILE]'
17371737
.is_ok();
17381738
}
17391739

1740+
#[tokio::test]
1741+
async fn toolchain_install_updates_toolchain() {
1742+
let mut cx = CliTestContext::new(Scenario::None).await;
1743+
1744+
{
1745+
let cx = cx.with_dist_dir(Scenario::ArchivesV2_2015_01_01);
1746+
cx.config
1747+
.expect(["rustup", "toolchain", "add", "stable"])
1748+
.await
1749+
.is_ok();
1750+
}
1751+
1752+
let cx = cx.with_dist_dir(Scenario::SimpleV2);
1753+
cx.config
1754+
.expect(["rustup", "install", "stable"])
1755+
.await
1756+
.with_stdout(snapbox::str![[r#"
1757+
1758+
stable-[HOST_TRIPLE] updated - 1.1.0 (hash-stable-1.1.0) (from 1.0.0 (hash-stable-1.0.0))
1759+
1760+
1761+
"#]])
1762+
.is_ok();
1763+
}
1764+
1765+
#[tokio::test]
1766+
async fn toolchain_install_no_change_with_no_update() {
1767+
let mut cx = CliTestContext::new(Scenario::None).await;
1768+
1769+
{
1770+
let cx = cx.with_dist_dir(Scenario::ArchivesV2_2015_01_01);
1771+
cx.config
1772+
.expect(["rustup", "toolchain", "add", "stable"])
1773+
.await
1774+
.is_ok();
1775+
}
1776+
1777+
let cx = cx.with_dist_dir(Scenario::SimpleV2);
1778+
cx.config
1779+
.expect(["rustup", "install", "--no-update", "stable"])
1780+
.await
1781+
.with_stdout(snapbox::str![[r#"
1782+
1783+
stable-[HOST_TRIPLE] unchanged - 1.0.0 (hash-stable-1.0.0)
1784+
1785+
1786+
"#]])
1787+
.with_stderr(snapbox::str![[""]])
1788+
.is_ok();
1789+
}
1790+
17401791
#[tokio::test]
17411792
async fn toolchain_update_is_like_update() {
17421793
let cx = CliTestContext::new(Scenario::SimpleV2).await;

0 commit comments

Comments
 (0)