nushell/crates/nu-std/tests
Stefan Holderbach c9e9b138eb
Improve with-env robustness (#12523)
# Description
Work for #7149

- **Error `with-env` given uneven count in list form**
- **Fix `with-env` `CantConvert` to record**
- **Error `with-env` when given protected env vars**
- **Deprecate list/table input of vars to `with-env`**
- **Remove examples for deprecated input**

# User-Facing Changes

## Deprecation of the following forms

```
> with-env [MYENV "my env value"] { $env.MYENV }
my env value

> with-env [X Y W Z] { $env.X }
Y

> with-env [[X W]; [Y Z]] { $env.W }
Z
```

## recommended standardized form

```
# Set by key-value record
> with-env {X: "Y", W: "Z"} { [$env.X $env.W] }
╭───┬───╮
│ 0 │ Y │
│ 1 │ Z │
╰───┴───╯
```

## (Side effect) Repeated definitions in an env shorthand are now
disallowed

```
> FOO=bar FOO=baz $env
Error: nu:🐚:column_defined_twice

  × Record field or table column used twice: FOO
   ╭─[entry #1:1:1]
 1 │ FOO=bar FOO=baz $env
   · ─┬─     ─┬─
   ·  │       ╰── field redefined here
   ·  ╰── field first defined here
   ╰────
```
2024-04-16 19:08:58 +08:00
..
logger_tests fix std log (#12470) 2024-04-10 17:30:58 -04:00
test_asserts.nu Rename into decimal to into float (#9979) 2023-09-12 13:02:47 +02:00
test_dirs.nu dirs goto: update current ring slot before leaving it. (#10706) 2023-10-13 06:46:51 -05:00
test_dt.nu std dt datetime-diff: fix uninitialized field ref when borrowing (#10466) 2023-09-24 10:53:56 +02:00
test_formats.nu to json -r not removing whitespaces fix (#11948) 2024-03-20 22:14:31 +01:00
test_iter.nu Implement annotations support in test runner (#9406) 2023-07-02 10:41:33 +02:00
test_setup_teardown.nu Implement annotations support in test runner (#9406) 2023-07-02 10:41:33 +02:00
test_std.nu Improve with-env robustness (#12523) 2024-04-16 19:08:58 +08:00
test_xml.nu Implement annotations support in test runner (#9406) 2023-07-02 10:41:33 +02:00