Skip to content

Commit

Permalink
make *dots* tests easier to read (#9467)
Browse files Browse the repository at this point in the history
related to
- nushell/nushell#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 🤔

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
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
  • Loading branch information
amtoine committed Jun 20, 2023
1 parent 1be4eae commit aaa21c1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions crates/nu-path/src/dots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.*[");
}
}

Expand Down Expand Up @@ -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.*[");
}
}
}

0 comments on commit aaa21c1

Please sign in to comment.