nushell/tests/shell
Douglas d702c4605a
Increment SHLVL before run_repl() (#14732)
# Description

A follow-on to #14727:

* Instead of using `is-interactive` as the trigger for incrementing
`SHLVL`, this change puts the increment logic just before `run_repl()`
is called.
* Tests are changed to use `-e`
* Moves the `confirm_stdin_is_terminal()` call immediately **after** the
`prerun_cmd` (which executes `--execute (-e) <commandstring>`. The fact
that it was **before** that call seems to be a bug, since the error
message says *"or provide arguments to invoke a script"* even if
`--execute` was used. This change enables REPL testing using `--execute
(-e)`.
* Added a test to ensure `-c` does *not* increment SHLVL.

# User-Facing Changes

`$env.SHLVL` runs before the REPL is started, rather than when
`is-interactive`

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

N/A
2025-01-03 15:16:57 -06:00
..
environment Increment SHLVL before run_repl() (#14732) 2025-01-03 15:16:57 -06:00
pipeline Add proper config defaults for hooks (#14341) 2024-11-14 20:27:26 -08:00
mod.rs Make the --no-newline test use --no-config-file as well (#14654) 2024-12-22 13:55:03 +01:00
repl.rs Fix merging child stack into parent (#12426) 2024-04-06 15:03:22 +00:00