From aaa21c161971e4474a87c1916486e71d37bff426 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Tue, 20 Jun 2023 10:28:10 +0200 Subject: [PATCH] make *dots* tests easier to read (#9467) related to - https://github.com/nushell/nushell/pull/8544 cc/ @jntrnr @ahkrr # Description some of the tests in the `dots.rs` file are a bit hard to read because some of the paths look like command calls :thinking: in an attempt to making them easier to read, in the tests of `dots.rs`, this PR - replaces `file .../` with `not_a_cmd.../` because it's not a call to the `file` command - removes the space in `not_a_cmd .../` to see it's not a command call - adds a bit more `not a cmd` to the last tests, to be consistent with the other tests # User-Facing Changes ``` $nothing ``` # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :black_circle: `toolkit test` - :black_circle: `toolkit test stdlib` --- crates/nu-path/src/dots.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/nu-path/src/dots.rs b/crates/nu-path/src/dots.rs index d421850f1c..72b96ffe85 100644 --- a/crates/nu-path/src/dots.rs +++ b/crates/nu-path/src/dots.rs @@ -295,7 +295,7 @@ mod tests { #[test] fn string_with_three_ndots_and_garbage() { - check_ndots_expansion(r"file .../ garbage.*[", "file .../ garbage.*["); + check_ndots_expansion(r"not_a_cmd.../ garbage.*[", "not_a_cmd.../ garbage.*["); } } @@ -324,12 +324,18 @@ mod tests { fn string_with_three_ndots_and_garbage() { // filenames can contain spaces, in these cases the ... .... etc. // that are part of a filepath should not be expanded - check_ndots_expansion("not_a_cmd .../ garbage.*[", "not_a_cmd .../ garbage.*["); - check_ndots_expansion("/not_a_cmd .../ garbage.*[", "/not_a_cmd .../ garbage.*["); - check_ndots_expansion("./not_a_cmd .../ garbage.*[", "./not_a_cmd .../ garbage.*["); - check_ndots_expansion("../../nac .../ garbage.*[", ".../nac .../ garbage.*["); - check_ndots_expansion("../../nac .../ garbage.*[...", ".../nac .../ garbage.*[..."); - check_ndots_expansion("../../ garbage.*[", ".../ garbage.*["); + check_ndots_expansion("not_a_cmd.../ garbage.*[", "not_a_cmd.../ garbage.*["); + check_ndots_expansion("/not_a_cmd.../ garbage.*[", "/not_a_cmd.../ garbage.*["); + check_ndots_expansion("./not_a_cmd.../ garbage.*[", "./not_a_cmd.../ garbage.*["); + check_ndots_expansion( + "../../not a cmd.../ garbage.*[", + ".../not a cmd.../ garbage.*[", + ); + check_ndots_expansion( + "../../not a cmd.../ garbage.*[...", + ".../not a cmd.../ garbage.*[...", + ); + check_ndots_expansion("../../ not a cmd garbage.*[", ".../ not a cmd garbage.*["); } } }