nushell/tests
Devyn Cairns 8e2917b9ae
Make assignment and const consistent with let/mut (#13385)
# Description

This makes assignment operations and `const` behave the same way `let`
and `mut` do, absorbing the rest of the pipeline.

Changes the lexer to be able to recognize assignment operators as a
separate token, and then makes the lite parser continue to push spans
into the same command regardless of any redirections or pipes if an
assignment operator is encountered. Because the pipeline is no longer
split up by the lite parser at this point, it's trivial to just parse
the right hand side as if it were a subexpression not contained within
parentheses.

# User-Facing Changes
Big breaking change. These are all now possible:

```nushell
const path = 'a' | path join 'b'

mut x = 2
$x = random int
$x = [1 2 3] | math sum

$env.FOO = random chars
```

In the past, these would have led to (an attempt at) bare word string
parsing. So while `$env.FOO = bar` would have previously set the
environment variable `FOO` to the string `"bar"`, it now tries to run
the command named `bar`, hence the major breaking change.

However, this is desirable because it is very consistent - if you see
the `=`, you can just assume it absorbs everything else to the right of
it.

# Tests + Formatting
Added tests for the new behaviour. Adjusted some existing tests that
depended on the right hand side of assignments being parsed as
barewords.

# After Submitting
- [ ] release notes (breaking change!)
2024-07-30 18:55:22 -05:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ Make assignment and const consistent with let/mut (#13385) 2024-07-30 18:55:22 -05:00
eval Internal representation (IR) compiler and evaluator (#13330) 2024-07-10 17:33:59 -07:00
fixtures Force completers to sort in fetch() (#13242) 2024-07-03 06:48:06 -05:00
hooks Fix hooks on 0.92.0 (#12383) 2024-04-04 09:25:54 +02:00
modules Enable reloading changes to a submodule (#13170) 2024-06-25 18:33:37 -07:00
overlays Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
parsing Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
path Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
plugin_persistence Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
plugins Make assignment and const consistent with let/mut (#13385) 2024-07-30 18:55:22 -05:00
repl Make assignment and const consistent with let/mut (#13385) 2024-07-30 18:55:22 -05:00
scope Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
shell IR: fix incorrect capturing of subexpressions (#13467) 2024-07-27 19:38:57 -07:00
main.rs Merged tests to produce a single binary (#12826) 2024-05-13 13:37:53 +00:00