Skip to content

Commit

Permalink
test: migrate testsuite version to snapbox
Browse files Browse the repository at this point in the history
  • Loading branch information
henry40408 committed Jun 20, 2024
1 parent 1e0dca3 commit 2c517d9
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions tests/testsuite/version.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
//! Tests for displaying the cargo version.
#![allow(deprecated)]

use cargo_test_support::{cargo_process, project};

#[cargo_test]
fn simple() {
let p = project().build();

p.cargo("version")
.with_stdout(&format!("cargo {}\n", cargo::version()))
.with_stdout_data(&format!("cargo {}\n", cargo::version()))
.run();

p.cargo("--version")
.with_stdout(&format!("cargo {}\n", cargo::version()))
.with_stdout_data(&format!("cargo {}\n", cargo::version()))
.run();

p.cargo("-V")
.with_stdout(&format!("cargo {}\n", cargo::version()))
.with_stdout_data(&format!("cargo {}\n", cargo::version()))
.run();
}

Expand Down Expand Up @@ -53,10 +51,19 @@ fn version_works_with_bad_target_dir() {
fn verbose() {
// This is mainly to check that it doesn't explode.
cargo_process("-vV")
.with_stdout_contains(&format!("cargo {}", cargo::version()))
.with_stdout_contains("host: [..]")
.with_stdout_contains("libgit2: [..]")
.with_stdout_contains("libcurl: [..]")
.with_stdout_contains("os: [..]")
.with_stdout_data(format!(
"\
cargo {}
release: [..]
commit-hash: [..]
commit-date: [..]
host: [HOST_TARGET]
libgit2: [..] (sys:[..] [..])
libcurl: [..] (sys:[..] [..])
...
os: [..]
",
cargo::version()
))
.run();
}

0 comments on commit 2c517d9

Please sign in to comment.