nushell/src/tests
JT b70cce47e2
disallow blocks as first-class values (#9587)
# Description

This PR disallows blocks as first-class values by removing the ability
to create them using the `block` syntax shape or type. Now, the parser
will only ever be able to create closures as first-class values.

This means that `{ 3 }` will always be treated as a closure, unless used
in the specifically supported use case of the literal being given as an
arg to `for`, `if` and other built-in block users.

Note: first-class value here means "value that can be passed into
commands and held in variables"

# User-Facing Changes

This may break some user scripts as `: block` is no longer allows as a
type annotation. Note: these cases were not actually supported before,
as, for example, passing a block that accessed a variable would have
errored when the block was later evaluated.

Closures do not have the restriction mentioned above and are the much
safer value to pass as first-class, so now they are the only block-like
value to be allowed to be passed.

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

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

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# 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-07-03 07:40:56 +12:00
..
test_bits.rs Re-enable test_bits (#7585) 2022-12-23 11:19:10 -08:00
test_cell_path.rs Cell paths: make optional path members short-circuit (#8554) 2023-03-23 09:54:19 +13:00
test_commandline.rs fix: fix cursor position when cursor is at the end of the commandline (#9030) 2023-04-28 07:02:45 -05:00
test_conditionals.rs Add OneOf shape to fix else (#7385) 2022-12-08 08:58:54 +13:00
test_config_path.rs Use pretty_assertions in the root crate (#8818) 2023-04-08 11:52:37 -07:00
test_config.rs Add config mutation tests (#7437) 2022-12-12 12:46:25 -06:00
test_converters.rs Fix to json escape logic (#4478) 2022-02-15 06:55:57 -05:00
test_custom_commands.rs Use pretty_assertions in the root crate (#8818) 2023-04-08 11:52:37 -07:00
test_engine.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
test_env.rs Remove the 'env' command, as we have the variable (#8185) 2023-03-01 21:20:00 +13:00
test_help.rs Parameter defaults to $nu.scope.commands (#9152) 2023-05-11 13:59:56 -05:00
test_hiding.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
test_ide.rs limit the ide-check error amount (#8875) 2023-04-13 12:53:18 -05:00
test_iteration.rs Remove deprecated --numbered flag from four commands (#7777) 2023-02-02 16:59:58 -06:00
test_known_external.rs Allow arguments for the last flag in short flag batch (#8808) 2023-04-15 10:24:51 +02:00
test_math.rs Change comparison operators to allow nulls (#8617) 2023-03-26 12:10:09 +13:00
test_modules.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
test_parser.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
test_ranges.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_regex.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_signatures.rs allow records to have type annotations (#8914) 2023-04-26 08:16:55 -05:00
test_stdlib.rs split $nu variable into scope commands and simpler $nu (#9487) 2023-06-21 09:33:01 +12:00
test_strings.rs improve operation mismatch errors (#8800) 2023-04-08 09:32:44 +12:00
test_table_operations.rs Optional members in cell paths: Attempt 2 (#8379) 2023-03-15 20:50:58 -07:00
test_type_check.rs disallow blocks as first-class values (#9587) 2023-07-03 07:40:56 +12:00