nushell/crates/nu-command/tests/commands
Bob Hyman 2894668b3e
Improve error when regex rejects pattern. Resolution of #8037 (#8050)
# Description

Improve error when `str replace <pattern>` detects a problem with
<pattern>.

# User-Facing Changes

New "Incorrect value" error:
```
〉 'C:\Users\kubouch' | str replace 'C:\Users' 'foo'
Error: nu:🐚:incorrect_value (link)

  × Incorrect value.
   ╭─[entry #1:1:1]
 1 │  'C:\Users\kubouch' | str replace 'C:\Users' 'foo'
   ·                                   ─────┬────
   ·                                        ╰── Regex error: Parsing error at position 4: Invalid hex escape
   ╰────
```

We could fruitfully replace some of the current uses of
`ShellError::UnsupportedInput` with this error. 'Incorrect value' is
different from 'wrong type'

# Tests + Formatting

Don't forget to add tests that cover your changes.
* none added / changed.

Make sure you've run and fixed any issues with these commands:

- [x] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
- [x] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- [x] `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2023-02-12 13:25:40 +00:00
..
assignment ++= appendAssign operator (#7346) (#7354) 2022-12-09 11:20:58 -05:00
date
hash_ Deprecate hash base64, extend decode and add encode commands (#5863) 2022-06-26 00:35:23 +03:00
math Make ++ operator work with strings and binary values (#8017) 2023-02-10 07:52:10 +13:00
move_ Fix mv error message issues (arrows, Windows paths) (#7197) 2022-11-23 16:55:13 +13:00
network
path add -n for path expand, so it doesn't follow symlink (#6255) 2022-08-10 08:43:56 -05:00
platform Validate input range of du flags (#7962) 2023-02-06 21:34:32 +01:00
query
random
skip last, skip, drop, take until, take while, skip until, skip while, where, reverse, shuffle, append, prepend and sort-by raise error when given non-lists (#7623) 2022-12-31 13:35:12 +02:00
str_ Improve error when regex rejects pattern. Resolution of #8037 (#8050) 2023-02-12 13:25:40 +00:00
take last, skip, drop, take until, take while, skip until, skip while, where, reverse, shuffle, append, prepend and sort-by raise error when given non-lists (#7623) 2022-12-31 13:35:12 +02:00
url Feat/7725 url join (#7823) 2023-01-22 19:49:40 +01:00
alias.rs
all.rs
any.rs
append.rs
break_.rs New commands: break, continue, return, and loop (#7230) 2022-11-25 09:39:16 +13:00
cal.rs return Error if get meet nothing and without "i" (#7002) 2022-12-31 13:27:09 +02:00
cd.rs Re-enable some good tests, remove some bad tests (#7875) 2023-01-28 14:56:47 -06:00
compact.rs
continue_.rs
cp.rs Fix: dst error on cp command (#7895) 2023-02-01 21:48:21 +01:00
def.rs
default.rs
do_.rs
drop.rs
each.rs
echo.rs
empty.rs
enter.rs
error_make.rs add unspanned flag to error make, add tests (#6017) 2022-07-12 06:03:50 -05:00
every.rs
exec.rs
export_def.rs
find.rs let find take linebreaks into account in Value::String (#7789) 2023-01-20 00:07:34 +01:00
first.rs
flatten.rs
for_.rs
format.rs prevent panic with format command (#7522) 2022-12-19 13:10:02 +01:00
g.rs Make g - switch to the last used shell (#6249) 2022-08-06 10:11:03 -05:00
get.rs
glob.rs Expose filtering by file type in glob (#7834) 2023-01-28 07:50:12 -06:00
group_by.rs more test fixes (#4499) 2022-02-16 12:24:45 -06:00
headers.rs Type validation for headers command (#6918) (#7047) 2022-11-09 16:43:24 -08:00
help.rs
histogram.rs
insert.rs
into_filesize.rs fix overflow on negative bytes (#7070) 2022-11-10 22:33:15 +01:00
into_int.rs
last.rs
length.rs
let_.rs Limited mutable variables (#7089) 2022-11-11 19:51:08 +13:00
lines.rs
loop_.rs
ls.rs Fix typos and use more idiomatic assertions (#7755) 2023-01-15 15:03:32 +13:00
merge.rs remove block input support in merge (#7177) 2022-11-23 17:01:27 +13:00
mkdir.rs Filesystem commands print --verbose to stderr (#8014) 2023-02-09 10:29:34 -08:00
mod.rs
mut_.rs
n.rs Refactor shell switching related code (#6258) 2022-08-07 13:30:40 -05:00
nu_check.rs
open.rs Add dfr to dataframe cmds (#7998) 2023-02-08 15:52:57 -06:00
p.rs Refactor shell switching related code (#6258) 2022-08-07 13:30:40 -05:00
parse.rs allow parse to work better with streams (#7870) 2023-02-08 20:59:02 -06:00
prepend.rs revert changes on prepend and append (#7660) 2023-01-02 17:09:55 -08:00
print.rs
range.rs
redirection.rs
reduce.rs Test return in reduce closure from #7961 (#7973) 2023-02-06 11:01:08 +01:00
reject.rs
rename.rs Standardise the use of ShellError::UnsupportedInput and ShellError::TypeMismatch and add spans to every instance of the former (#7217) 2022-12-23 01:48:53 -05:00
return_.rs
reverse.rs last, skip, drop, take until, take while, skip until, skip while, where, reverse, shuffle, append, prepend and sort-by raise error when given non-lists (#7623) 2022-12-31 13:35:12 +02:00
rm.rs
roll.rs
rotate.rs
run_external.rs Trim quotes when shelling out to cmd.exe (#7740) 2023-01-13 11:00:30 -08:00
save.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00
select.rs Make get hole errors and cell path hole errors identical (improvement on #7002) (#7647) 2023-01-02 14:45:43 -08:00
semicolon.rs nu-cli refactor moving commands into their own crate nu-command (#2910) 2021-01-12 17:59:53 +13:00
seq_char.rs
seq.rs Make stream info visible to users in describe (#7589) 2023-01-03 21:08:05 -08:00
shells.rs Refactor shell listing related code (#6262) 2022-08-08 06:31:24 -05:00
sort_by.rs
sort.rs
source_env.rs ensure that when nu evaluates files, it allows early returns (#7415) 2023-02-02 00:02:27 +01:00
split_by.rs
split_column.rs refactor: change column names from 'Column*' to 'column*' (#4556) 2022-02-19 19:26:47 -05:00
split_row.rs Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
table.rs Minor clippy: inline format string (#8043) 2023-02-11 17:47:08 +00:00
to_text.rs Make to text stream ListStreams (#7577) 2022-12-22 16:38:07 -08:00
touch.rs
transpose.rs
try_.rs fix some typos (#7773) 2023-01-16 12:43:46 +01:00
uniq_by.rs
uniq.rs
update.rs
upsert.rs
use_.rs
where_.rs
which.rs
while_.rs
with_env.rs
wrap.rs
zip.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00