Skip to content

Commit cc1a437

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

14 files changed

+133
-123
lines changed

tests/cli-exact.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Yet more cli test cases. These are testing that the output
23
//! is exactly as expected.
34
4-
pub mod mock;
5+
crate mod mock;
56

67
use crate::mock::clitools::{
78
self, check_update_setup, expect_err_ex, expect_ok, expect_ok_ex, expect_stdout_ok,

tests/cli-inst-interactive.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Tests of the interactive console installer
23
3-
pub mod mock;
4+
crate mod mock;
45

56
use std::env::consts::EXE_SUFFIX;
67
use std::io::Write;

tests/cli-misc.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Test cases of the rustup command that do not depend on the
23
//! dist server, mostly derived from multirust/test-v2.sh
34
4-
pub mod mock;
5+
crate mod mock;
56

67
use std::env::consts::EXE_SUFFIX;
78
use std::str;
@@ -16,7 +17,7 @@ use crate::mock::clitools::{
1617
expect_stderr_ok, expect_stdout_ok, run, set_current_dist_date, Config, Scenario,
1718
};
1819

19-
pub fn setup(f: &dyn Fn(&mut Config)) {
20+
crate fn setup(f: &dyn Fn(&mut Config)) {
2021
clitools::setup(Scenario::SimpleV2, f);
2122
}
2223

@@ -325,7 +326,7 @@ fn rustup_failed_path_search() {
325326
expect_err(
326327
config,
327328
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'",),
329+
&"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(),
329330
);
330331

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

tests/cli-paths.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
//! This file contains tests relevant to Rustup's handling of updating PATHs.
23
//! It depends on self-update working, so if absolutely everything here breaks,
34
//! check those tests as well.
4-
pub mod mock;
5+
crate mod mock;
56

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

tests/cli-rustup.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Test cases for new rustup UI
23
3-
pub mod mock;
4+
crate mod mock;
45

56
use std::env::consts::EXE_SUFFIX;
67
use std::fs;
@@ -21,7 +22,7 @@ macro_rules! for_host_and_home {
2122
};
2223
}
2324

24-
pub fn setup(f: &dyn Fn(&Config)) {
25+
crate fn setup(f: &dyn Fn(&Config)) {
2526
clitools::setup(Scenario::ArchivesV2, &|config| {
2627
f(config);
2728
});

tests/cli-self-upd.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Testing self install, uninstall and update
23
3-
pub mod mock;
4+
crate mod mock;
45

56
use std::env;
67
use std::env::consts::EXE_SUFFIX;
@@ -24,7 +25,7 @@ use crate::mock::dist::calc_hash;
2425

2526
const TEST_VERSION: &str = "1.1.1";
2627

27-
pub fn update_setup(f: &dyn Fn(&Config, &Path)) {
28+
crate fn update_setup(f: &dyn Fn(&Config, &Path)) {
2829
self_update_setup(f, TEST_VERSION)
2930
}
3031

tests/cli-v1.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Test cases of the rustup command, using v1 manifests, mostly
23
//! derived from multirust/test-v2.sh
34
4-
pub mod mock;
5+
crate mod mock;
56

67
use std::fs;
78

@@ -12,7 +13,7 @@ use crate::mock::clitools::{
1213
Scenario,
1314
};
1415

15-
pub fn setup(f: &dyn Fn(&mut Config)) {
16+
crate fn setup(f: &dyn Fn(&mut Config)) {
1617
clitools::setup(Scenario::SimpleV1, f);
1718
}
1819

tests/cli-v2.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
//! Test cases of the rustup command, using v2 manifests, mostly
23
//! derived from multirust/test-v2.sh
34
4-
pub mod mock;
5+
crate mod mock;
56

67
use std::fs;
78
use std::io::Write;
@@ -16,11 +17,11 @@ use crate::mock::clitools::{
1617
expect_stdout_ok, set_current_dist_date, Config, Scenario,
1718
};
1819

19-
pub fn setup(f: &dyn Fn(&mut Config)) {
20+
crate fn setup(f: &dyn Fn(&mut Config)) {
2021
clitools::setup(Scenario::SimpleV2, f);
2122
}
2223

23-
pub fn setup_complex(f: &dyn Fn(&mut Config)) {
24+
crate fn setup_complex(f: &dyn Fn(&mut Config)) {
2425
clitools::setup(Scenario::UnavailableRls, f);
2526
}
2627

tests/dist.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(crate_visibility_modifier)]
12
// Tests of installation and updates from a v2 Rust distribution
23
// server (mocked on the file system)
34

4-
pub mod mock;
5+
crate mod mock;
56

67
use std::cell::Cell;
78
use std::collections::HashMap;
@@ -33,7 +34,7 @@ use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
3334
const SHA256_HASH_LEN: usize = 64;
3435

3536
// Creates a mock dist server populated with some test data
36-
pub fn create_mock_dist_server(
37+
crate fn create_mock_dist_server(
3738
path: &Path,
3839
edit: Option<&dyn Fn(&str, &mut MockChannel)>,
3940
) -> MockDistServer {
@@ -46,7 +47,7 @@ pub fn create_mock_dist_server(
4647
}
4748
}
4849

49-
pub fn create_mock_channel(
50+
crate fn create_mock_channel(
5051
channel: &str,
5152
date: &str,
5253
edit: Option<&dyn Fn(&str, &mut MockChannel)>,

tests/dist_install.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
pub mod mock;
1+
#![feature(crate_visibility_modifier)]
2+
3+
crate mod mock;
24

35
use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
46
use rustup::dist::component::Components;

0 commit comments

Comments
 (0)