Skip to content

Commit f22c43b

Browse files
committed
fix(test)!: Hide API that isnt used by Cargo
1 parent 995c2b7 commit f22c43b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

crates/cargo-test-support/src/compare.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn substitute_macros(input: &str) -> String {
254254
///
255255
/// - `description` explains where the output is from (usually "stdout" or "stderr").
256256
/// - `other_output` is other output to display in the error (usually stdout or stderr).
257-
pub fn match_exact(
257+
pub(crate) fn match_exact(
258258
expected: &str,
259259
actual: &str,
260260
description: &str,
@@ -369,7 +369,11 @@ pub fn match_contains(expected: &str, actual: &str, cwd: Option<&Path>) -> Resul
369369
/// anywhere.
370370
///
371371
/// See [Patterns](index.html#patterns) for more information on pattern matching.
372-
pub fn match_does_not_contain(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()> {
372+
pub(crate) fn match_does_not_contain(
373+
expected: &str,
374+
actual: &str,
375+
cwd: Option<&Path>,
376+
) -> Result<()> {
373377
if match_contains(expected, actual, cwd).is_ok() {
374378
bail!(
375379
"expected not to find:\n\
@@ -388,7 +392,7 @@ pub fn match_does_not_contain(expected: &str, actual: &str, cwd: Option<&Path>)
388392
/// somewhere, and should be repeated `number` times.
389393
///
390394
/// See [Patterns](index.html#patterns) for more information on pattern matching.
391-
pub fn match_contains_n(
395+
pub(crate) fn match_contains_n(
392396
expected: &str,
393397
number: usize,
394398
actual: &str,
@@ -425,7 +429,7 @@ pub fn match_contains_n(
425429
///
426430
/// See [`crate::Execs::with_stderr_line_without`] for an example and cautions
427431
/// against using.
428-
pub fn match_with_without(
432+
pub(crate) fn match_with_without(
429433
actual: &str,
430434
with: &[String],
431435
without: &[String],
@@ -473,7 +477,7 @@ pub fn match_with_without(
473477
/// expected JSON objects.
474478
///
475479
/// See [`crate::Execs::with_json`] for more details.
476-
pub fn match_json(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()> {
480+
pub(crate) fn match_json(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()> {
477481
let (exp_objs, act_objs) = collect_json_objects(expected, actual)?;
478482
if exp_objs.len() != act_objs.len() {
479483
bail!(
@@ -494,7 +498,7 @@ pub fn match_json(expected: &str, actual: &str, cwd: Option<&Path>) -> Result<()
494498
///
495499
/// See [`crate::Execs::with_json_contains_unordered`] for more details and
496500
/// cautions when using.
497-
pub fn match_json_contains_unordered(
501+
pub(crate) fn match_json_contains_unordered(
498502
expected: &str,
499503
actual: &str,
500504
cwd: Option<&Path>,
@@ -552,7 +556,11 @@ fn collect_json_objects(
552556
/// as paths). You can use a `"{...}"` string literal as a wildcard for
553557
/// arbitrary nested JSON (useful for parts of object emitted by other programs
554558
/// (e.g., rustc) rather than Cargo itself).
555-
pub fn find_json_mismatch(expected: &Value, actual: &Value, cwd: Option<&Path>) -> Result<()> {
559+
pub(crate) fn find_json_mismatch(
560+
expected: &Value,
561+
actual: &Value,
562+
cwd: Option<&Path>,
563+
) -> Result<()> {
556564
match find_json_mismatch_r(expected, actual, cwd) {
557565
Some((expected_part, actual_part)) => bail!(
558566
"JSON mismatch\nExpected:\n{}\nWas:\n{}\nExpected part:\n{}\nActual part:\n{}\n",
@@ -619,7 +627,7 @@ fn find_json_mismatch_r<'a>(
619627
}
620628

621629
/// A single line string that supports `[..]` wildcard matching.
622-
pub struct WildStr<'a> {
630+
pub(crate) struct WildStr<'a> {
623631
has_meta: bool,
624632
line: &'a str,
625633
}

0 commit comments

Comments
 (0)