Skip to content

Make all tests functions and structs crate-private #2735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/cli-exact.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Yet more cli test cases. These are testing that the output
//! is exactly as expected.

pub mod mock;
pub(crate) mod mock;

use crate::mock::clitools::{
self, check_update_setup, expect_err_ex, expect_ok, expect_ok_ex, expect_stdout_ok,
Expand Down
2 changes: 1 addition & 1 deletion tests/cli-inst-interactive.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Tests of the interactive console installer

pub mod mock;
pub(crate) mod mock;

use std::env::consts::EXE_SUFFIX;
use std::io::Write;
Expand Down
4 changes: 2 additions & 2 deletions tests/cli-misc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Test cases of the rustup command that do not depend on the
//! dist server, mostly derived from multirust/test-v2.sh

pub mod mock;
pub(crate) mod mock;

use std::env::consts::EXE_SUFFIX;
use std::str;
Expand All @@ -16,7 +16,7 @@ use crate::mock::clitools::{
expect_stderr_ok, expect_stdout_ok, run, set_current_dist_date, Config, Scenario,
};

pub fn setup(f: &dyn Fn(&mut Config)) {
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
clitools::setup(Scenario::SimpleV2, f);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cli-paths.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This file contains tests relevant to Rustup's handling of updating PATHs.
//! It depends on self-update working, so if absolutely everything here breaks,
//! check those tests as well.
pub mod mock;
pub(crate) mod mock;

// Prefer omitting actually unpacking content while just testing paths.
const INIT_NONE: [&str; 4] = ["rustup-init", "-y", "--default-toolchain", "none"];
Expand Down
4 changes: 2 additions & 2 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Test cases for new rustup UI

pub mod mock;
pub(crate) mod mock;

use std::env::consts::EXE_SUFFIX;
use std::fs;
Expand All @@ -21,7 +21,7 @@ macro_rules! for_host_and_home {
};
}

pub fn setup(f: &dyn Fn(&Config)) {
pub(crate) fn setup(f: &dyn Fn(&Config)) {
clitools::setup(Scenario::ArchivesV2, &|config| {
f(config);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/cli-self-upd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Testing self install, uninstall and update

pub mod mock;
pub(crate) mod mock;

use std::env;
use std::env::consts::EXE_SUFFIX;
Expand All @@ -24,7 +24,7 @@ use crate::mock::dist::calc_hash;

const TEST_VERSION: &str = "1.1.1";

pub fn update_setup(f: &dyn Fn(&Config, &Path)) {
pub(crate) fn update_setup(f: &dyn Fn(&Config, &Path)) {
self_update_setup(f, TEST_VERSION)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/cli-v1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Test cases of the rustup command, using v1 manifests, mostly
//! derived from multirust/test-v2.sh

pub mod mock;
pub(crate) mod mock;

use std::fs;

Expand All @@ -12,7 +12,7 @@ use crate::mock::clitools::{
Scenario,
};

pub fn setup(f: &dyn Fn(&mut Config)) {
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
clitools::setup(Scenario::SimpleV1, f);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/cli-v2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Test cases of the rustup command, using v2 manifests, mostly
//! derived from multirust/test-v2.sh

pub mod mock;
pub(crate) mod mock;

use std::fs;
use std::io::Write;
Expand All @@ -16,11 +16,11 @@ use crate::mock::clitools::{
expect_stdout_ok, set_current_dist_date, Config, Scenario,
};

pub fn setup(f: &dyn Fn(&mut Config)) {
pub(crate) fn setup(f: &dyn Fn(&mut Config)) {
clitools::setup(Scenario::SimpleV2, f);
}

pub fn setup_complex(f: &dyn Fn(&mut Config)) {
pub(crate) fn setup_complex(f: &dyn Fn(&mut Config)) {
clitools::setup(Scenario::UnavailableRls, f);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/dist.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests of installation and updates from a v2 Rust distribution
// server (mocked on the file system)

pub mod mock;
pub(crate) mod mock;

use std::cell::Cell;
use std::collections::HashMap;
Expand Down Expand Up @@ -33,7 +33,7 @@ use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
const SHA256_HASH_LEN: usize = 64;

// Creates a mock dist server populated with some test data
pub fn create_mock_dist_server(
pub(crate) fn create_mock_dist_server(
path: &Path,
edit: Option<&dyn Fn(&str, &mut MockChannel)>,
) -> MockDistServer {
Expand All @@ -46,7 +46,7 @@ pub fn create_mock_dist_server(
}
}

pub fn create_mock_channel(
pub(crate) fn create_mock_channel(
channel: &str,
date: &str,
edit: Option<&dyn Fn(&str, &mut MockChannel)>,
Expand Down
2 changes: 1 addition & 1 deletion tests/dist_install.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod mock;
pub(crate) mod mock;

use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
use rustup::dist::component::Components;
Expand Down
Loading