Skip to content

Commit 5b9799c

Browse files
committed
refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can present how `cargo-test-support` works. Yes, this included some `use` clean ups but its already painful enough walking through every test file, I didn't want to do it twice.
1 parent 090064c commit 5b9799c

File tree

164 files changed

+295
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+295
-112
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ features = [
237237

238238
[dev-dependencies]
239239
annotate-snippets = { workspace = true, features = ["testing-colors"] }
240-
cargo-test-macro.workspace = true
241240
cargo-test-support.workspace = true
242241
gix = { workspace = true, features = ["revision"] }
243242
same-file.workspace = true

tests/build-std/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![allow(clippy::disallowed_methods)]
2222

2323
use cargo_test_support::prelude::*;
24-
use cargo_test_support::*;
24+
use cargo_test_support::{basic_manifest, paths, project, rustc_host, str, Execs};
2525
use std::env;
2626
use std::path::Path;
2727

tests/testsuite/advanced_env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! -Zadvanced-env tests
22
3+
use cargo_test_support::prelude::*;
34
use cargo_test_support::{paths, project, registry::Package};
45

56
#[cargo_test]

tests/testsuite/alt_registry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//! Tests for alternative registries.
22
3+
use std::fs;
4+
35
use cargo_test_support::compare::assert_e2e;
46
use cargo_test_support::prelude::*;
57
use cargo_test_support::publish::validate_alt_upload;
68
use cargo_test_support::registry::{self, Package, RegistryBuilder};
79
use cargo_test_support::str;
810
use cargo_test_support::{basic_manifest, paths, project};
9-
use std::fs;
1011

1112
#[cargo_test]
1213
fn depend_on_alt_registry() {

tests/testsuite/artifact_dir.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//! Tests for --artifact-dir flag.
22
3+
use std::env;
4+
use std::fs;
5+
use std::path::Path;
6+
37
use cargo_test_support::prelude::*;
48
use cargo_test_support::sleep_ms;
59
use cargo_test_support::str;
610
use cargo_test_support::{basic_manifest, project};
7-
use std::env;
8-
use std::fs;
9-
use std::path::Path;
1011

1112
#[cargo_test]
1213
fn binary_with_debug() {

tests/testsuite/build.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! Tests for the `cargo build` command.
22
3+
use std::env;
4+
use std::fs;
5+
use std::io::Read;
6+
use std::process::Stdio;
7+
38
use cargo::{
49
core::compiler::CompileMode,
510
core::{Shell, Workspace},
@@ -17,10 +22,6 @@ use cargo_test_support::{
1722
tools, Execs, ProjectBuilder,
1823
};
1924
use cargo_util::paths::dylib_path_envvar;
20-
use std::env;
21-
use std::fs;
22-
use std::io::Read;
23-
use std::process::Stdio;
2425

2526
#[cargo_test]
2627
fn cargo_compile_simple() {

tests/testsuite/build_script.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! Tests for build.rs scripts.
22
3+
use std::env;
4+
use std::fs;
5+
use std::io;
6+
use std::thread;
7+
38
use cargo_test_support::compare::assert_e2e;
49
use cargo_test_support::install::cargo_home;
510
use cargo_test_support::paths::CargoPathExt;
@@ -12,10 +17,6 @@ use cargo_test_support::{
1217
};
1318
use cargo_test_support::{rustc_host, sleep_ms, slow_cpu_multiplier, symlink_supported};
1419
use cargo_util::paths::{self, remove_dir_all};
15-
use std::env;
16-
use std::fs;
17-
use std::io;
18-
use std::thread;
1920

2021
#[cargo_test]
2122
fn custom_build_script_failed() {

tests/testsuite/build_script_env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Tests for build.rs rerun-if-env-changed and rustc-env
22
33
use cargo_test_support::basic_manifest;
4+
use cargo_test_support::prelude::*;
45
use cargo_test_support::project;
56
use cargo_test_support::sleep_ms;
67
use cargo_test_support::str;

tests/testsuite/build_script_extra_link_arg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// because MSVC link.exe just gives a warning on unknown flags (how helpful!),
55
// and other linkers will return an error.
66

7+
use cargo_test_support::prelude::*;
78
use cargo_test_support::registry::Package;
89
use cargo_test_support::str;
910
use cargo_test_support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};

0 commit comments

Comments
 (0)