Just's first parser performed both parsing, i.e the transformation of a
token stream according to the language grammar, and a number of consistency
checks and analysis passes.
This made parsing and analysis quite complex, so this diff introduces a
new, much cleaner `Parser`, and moves existing analysis into a dedicated
`Analyzer`.
- Refactor the lexer tests to be more readable, abandoning the
previous string-based summary DSL in favor of a more obvious
sequence of `TokenKinds` with optional lexemes. The new tests
also test that token lexemes are correct.
- Move duplicated `unindent` function into a shared crate,
`test-utilities`. This new versionless dev-dependency will
prevent publishing to crates.io, at least until rust-lang/cargo/pull/7333
makes it into stable. If we publish a new version before then,
test-utilities will need to be published to crates.io, so we can depend
on it by version.
Since error code 1 is commonly used to indicate failure, change those
integration tests which test that a specific error code is returned to
use something other than 1.
Adds an `unindent()` function that strips common leading indentation
from strings, and apply it to integration test case strings, so that they
can be written in a more readable style.
This commit changes the integration tests to run with bash
as the shell, instead of bash, dash, and the system's sh.
Running the integration tests with multiple shells has never
revealed a bug in Just, and they make the tests take longer,
so let's get rid of them.
Previously, warnings upon encountering a deprecated use `=` in
assignments, exports, and aliases would print a message without any
indication of where the offending `=` was. This diff adds a proper
`Warning` enum, and uses it to report context, as is done with
compilation and runtime errors.
Given the following justfile:
alias b := build
build:
echo 'Building!'
Just will show the alias along with the recipe:
$ just --show b
alias b := build
build:
echo 'Building!'
Integration tests run with bash, dash, and whatever's installed as `sh`, to ensure compatibility with a wide range of systems.
This commit changed the way that dash escapes special characters, which broke the integration tests:
https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=6900ff60ef7347a8c1445853a8f4689808e0976e
This commit modifies our tests to be compatible with dash before and after the changes, and should fix the Travis build.
The invalid escape sequence error message is delimited with backticks
and isn't used as input to other programs. This diff tweaks the escaping rules
slightly when printing invalid escape sequences. In particular, `, \, ',
and " are now not be escaped.
`env_var(key)` looks up the value of the environment variable with name `key`, aborting execution if it is not found.
`env_var_or_default(key, default)` looks up the value of the environment variable with name `key`, returning `default` if it is not found.