nushell/tests
Yehuda Katz 1ad9d6f199 Overhaul the expansion system
The main thrust of this (very large) commit is an overhaul of the
expansion system.

The parsing pipeline is:

- Lightly parse the source file for atoms, basic delimiters and pipeline
  structure into a token tree
- Expand the token tree into a HIR (high-level intermediate
  representation) based upon the baseline syntax rules for expressions
  and the syntactic shape of commands.

Somewhat non-traditionally, nu doesn't have an AST at all. It goes
directly from the token tree, which doesn't represent many important
distinctions (like the difference between `hello` and `5KB`) directly
into a high-level representation that doesn't have a direct
correspondence to the source code.

At a high level, nu commands work like macros, in the sense that the
syntactic shape of the invocation of a command depends on the
definition of a command.

However, commands do not have the ability to perform unrestricted
expansions of the token tree. Instead, they describe their arguments in
terms of syntactic shapes, and the expander expands the token tree into
HIR based upon that definition.

For example, the `where` command says that it takes a block as its first
required argument, and the description of the block syntactic shape
expands the syntax `cpu > 10` into HIR that represents
`{ $it.cpu > 10 }`.

This commit overhauls that system so that the syntactic shapes are
described in terms of a few new traits (`ExpandSyntax` and
`ExpandExpression` are the primary ones) that are more composable than
the previous system.

The first big win of this new system is the addition of the `ColumnPath`
shape, which looks like `cpu."max ghz"` or `package.version`.
Previously, while a variable path could look like `$it.cpu."max ghz"`,
the tail of a variable path could not be easily reused in other
contexts. Now, that tail is its own syntactic shape, and it can be used
as part of a command's signature.

This cleans up commands like `inc`, `add` and `edit` as well as
shorthand blocks, which can now look like `| where cpu."max ghz" > 10`
2019-10-10 08:27:51 -07:00
..
fixtures Add urlencode/urldecode 2019-09-19 16:25:29 +12:00
helpers Overhaul the expansion system 2019-10-10 08:27:51 -07:00
command_cd_tests.rs Filesystem shell can't cd into files. Ever. 2019-09-24 15:34:30 -05:00
command_config_test.rs Assert the column is unknown. 2019-09-14 14:53:31 -05:00
command_cp_tests.rs Trim trailing whitespace and set it in editorconfig 2019-09-03 02:52:52 +02:00
command_enter_test.rs Readability improvement. 2019-08-29 01:31:56 -05:00
command_ls_tests.rs run rustfmt 2019-09-11 10:36:50 -04:00
command_mkdir_tests.rs Readability improvement. 2019-08-29 01:31:56 -05:00
command_mv_tests.rs run rustfmt 2019-09-11 10:36:50 -04:00
command_open_tests.rs Overhaul the expansion system 2019-10-10 08:27:51 -07:00
command_rm_tests.rs run rustfmt 2019-09-11 10:36:50 -04:00
commands_test.rs first and get coverage. 2019-09-12 05:22:58 -05:00
external_tests.rs run rustfmt 2019-09-11 10:36:50 -04:00
filter_inc_tests.rs run rustfmt 2019-09-11 10:36:50 -04:00
filter_str_tests.rs pass lint checks. 2019-09-12 01:49:01 -05:00
filters_test.rs Add urlencode/urldecode 2019-09-19 16:25:29 +12:00
tests.rs Attempt so simplify classified 2019-09-08 14:00:04 +12:00