Skip to content

Commit 3192949

Browse files
committed
Make all tests functions and structs crate-private
1 parent a738acd commit 3192949

14 files changed

+137
-122
lines changed

tests/cli-exact.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Yet more cli test cases. These are testing that the output
22
//! is exactly as expected.
33
4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
use crate::mock::clitools::{
77
self, check_update_setup, expect_err_ex, expect_ok, expect_ok_ex, expect_stdout_ok,

tests/cli-inst-interactive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Tests of the interactive console installer
22
3-
pub mod mock;
3+
pub(crate) mod mock;
44

55
use std::env::consts::EXE_SUFFIX;
66
use std::io::Write;

tests/cli-misc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test cases of the rustup command that do not depend on the
22
//! dist server, mostly derived from multirust/test-v2.sh
33
4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
use std::env::consts::EXE_SUFFIX;
77
use std::str;
@@ -16,7 +16,7 @@ use crate::mock::clitools::{
1616
expect_stderr_ok, expect_stdout_ok, run, set_current_dist_date, Config, Scenario,
1717
};
1818

19-
pub fn setup(f: &dyn Fn(&mut Config)) {
19+
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
2020
clitools::setup(Scenario::SimpleV2, f);
2121
}
2222

@@ -325,7 +325,7 @@ fn rustup_failed_path_search() {
325325
expect_err(
326326
config,
327327
broken,
328-
&format!("unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri'",),
328+
&"unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri'".to_string(),
329329
);
330330

331331
// Hardlink will be automatically cleaned up by test setup code

tests/cli-paths.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This file contains tests relevant to Rustup's handling of updating PATHs.
22
//! It depends on self-update working, so if absolutely everything here breaks,
33
//! check those tests as well.
4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
// Prefer omitting actually unpacking content while just testing paths.
77
const INIT_NONE: [&str; 4] = ["rustup-init", "-y", "--default-toolchain", "none"];

tests/cli-rustup.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Test cases for new rustup UI
22
3-
pub mod mock;
3+
pub(crate) mod mock;
44

55
use std::env::consts::EXE_SUFFIX;
66
use std::fs;
@@ -21,7 +21,7 @@ macro_rules! for_host_and_home {
2121
};
2222
}
2323

24-
pub fn setup(f: &dyn Fn(&Config)) {
24+
pub(crate) fn setup(f: &dyn Fn(&Config)) {
2525
clitools::setup(Scenario::ArchivesV2, &|config| {
2626
f(config);
2727
});

tests/cli-self-upd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Testing self install, uninstall and update
22
3-
pub mod mock;
3+
pub(crate) mod mock;
44

55
use std::env;
66
use std::env::consts::EXE_SUFFIX;
@@ -24,7 +24,7 @@ use crate::mock::dist::calc_hash;
2424

2525
const TEST_VERSION: &str = "1.1.1";
2626

27-
pub fn update_setup(f: &dyn Fn(&Config, &Path)) {
27+
pub(crate) fn update_setup(f: &dyn Fn(&Config, &Path)) {
2828
self_update_setup(f, TEST_VERSION)
2929
}
3030

tests/cli-v1.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test cases of the rustup command, using v1 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
use std::fs;
77

@@ -12,7 +12,7 @@ use crate::mock::clitools::{
1212
Scenario,
1313
};
1414

15-
pub fn setup(f: &dyn Fn(&mut Config)) {
15+
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
1616
clitools::setup(Scenario::SimpleV1, f);
1717
}
1818

tests/cli-v2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test cases of the rustup command, using v2 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
use std::fs;
77
use std::io::Write;
@@ -16,11 +16,11 @@ use crate::mock::clitools::{
1616
expect_stdout_ok, set_current_dist_date, Config, Scenario,
1717
};
1818

19-
pub fn setup(f: &dyn Fn(&mut Config)) {
19+
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
2020
clitools::setup(Scenario::SimpleV2, f);
2121
}
2222

23-
pub fn setup_complex(f: &dyn Fn(&mut Config)) {
23+
pub(crate) fn setup_complex(f: &dyn Fn(&mut Config)) {
2424
clitools::setup(Scenario::UnavailableRls, f);
2525
}
2626

tests/dist.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Tests of installation and updates from a v2 Rust distribution
22
// server (mocked on the file system)
33

4-
pub mod mock;
4+
pub(crate) mod mock;
55

66
use std::cell::Cell;
77
use std::collections::HashMap;
@@ -33,7 +33,7 @@ use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
3333
const SHA256_HASH_LEN: usize = 64;
3434

3535
// Creates a mock dist server populated with some test data
36-
pub fn create_mock_dist_server(
36+
pub(crate) fn create_mock_dist_server(
3737
path: &Path,
3838
edit: Option<&dyn Fn(&str, &mut MockChannel)>,
3939
) -> MockDistServer {
@@ -46,7 +46,7 @@ pub fn create_mock_dist_server(
4646
}
4747
}
4848

49-
pub fn create_mock_channel(
49+
pub(crate) fn create_mock_channel(
5050
channel: &str,
5151
date: &str,
5252
edit: Option<&dyn Fn(&str, &mut MockChannel)>,

tests/dist_install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub mod mock;
1+
pub(crate) mod mock;
22

33
use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
44
use rustup::dist::component::Components;

0 commit comments

Comments
 (0)