Skip to content

Commit

Permalink
test: Migrate old_cargos to snapbox
Browse files Browse the repository at this point in the history
This is part of rust-lang#14039
  • Loading branch information
epage committed Aug 15, 2024
1 parent 9a170d7 commit 7977e04
Showing 1 changed file with 36 additions and 41 deletions.
77 changes: 36 additions & 41 deletions tests/testsuite/old_cargos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
//! cargo test --test testsuite -- old_cargos --nocapture --ignored
//! ```

#![allow(deprecated)]

use std::fs;

use cargo::CargoResult;
use cargo_test_support::prelude::*;
use cargo_test_support::registry::{self, Dependency, Package};
use cargo_test_support::{cargo_exe, execs, paths, process, project, rustc_host};
use cargo_test_support::{cargo_exe, execs, paths, process, project, rustc_host, str};
use cargo_util::{ProcessBuilder, ProcessError};
use semver::Version;

Expand Down Expand Up @@ -640,32 +638,32 @@ fn index_cache_rebuild() {
.with_process_builder(tc_process("cargo", "1.48.0"))
.arg("check")
.cwd(p.root())
.with_stderr(
"\
[UPDATING] [..]
.with_stderr_data(str![[r#"
[UPDATING] `[ROOT]/registry` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v1.0.0 [..]
[DOWNLOADED] bar v1.0.0 (registry `[ROOT]/registry`)
[CHECKING] bar v1.0.0
[CHECKING] foo v0.1.0 [..]
[FINISHED] [..]
",
)
[CHECKING] foo v0.1.0 ([ROOT]/foo)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();

fs::remove_file(p.root().join("Cargo.lock")).unwrap();

// This should rebuild the cache and use 1.0.1.
p.cargo("check")
.with_stderr(
"\
[UPDATING] [..]
.with_stderr_data(str![[r#"
[WARNING] no edition set: defaulting to the 2015 edition while the latest is [..]
[UPDATING] `dummy-registry` index
[LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ...
[DOWNLOADED] bar v1.0.1 [..]
[DOWNLOADED] bar v1.0.1 (registry `dummy-registry`)
[CHECKING] bar v1.0.1
[CHECKING] foo v0.1.0 [..]
[FINISHED] [..]
",
)
[CHECKING] foo v0.1.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();

fs::remove_file(p.root().join("Cargo.lock")).unwrap();
Expand All @@ -675,12 +673,11 @@ fn index_cache_rebuild() {
.with_process_builder(tc_process("cargo", "1.48.0"))
.arg("tree")
.cwd(p.root())
.with_stdout(
"\
foo v0.1.0 [..]
.with_stdout_data(str![[r#"
foo v0.1.0 ([ROOT]/foo)
└── bar v1.0.0
",
)
"#]])
.run();
}

Expand Down Expand Up @@ -714,33 +711,31 @@ fn avoids_split_debuginfo_collision() {
.arg("build")
.env("CARGO_INCREMENTAL", "1")
.cwd(p.root())
.with_stderr(
"\
[COMPILING] foo v0.1.0 [..]
[FINISHED] [..]
",
)
.with_stderr_data(str![[r#"
[COMPILING] foo v0.1.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();

p.cargo("build")
.env("CARGO_INCREMENTAL", "1")
.with_stderr(
"\
[COMPILING] foo v0.1.0 [..]
[FINISHED] [..]
",
)
.with_stderr_data(str![[r#"
[WARNING] no edition set: defaulting to the 2015 edition while the latest is [..]
[COMPILING] foo v0.1.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();

execs()
.with_process_builder(tc_process("cargo", "stable"))
.arg("build")
.env("CARGO_INCREMENTAL", "1")
.cwd(p.root())
.with_stderr(
"\
[FINISHED] [..]
",
)
.with_stderr_data(str![[r#"
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
}

0 comments on commit 7977e04

Please sign in to comment.