mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
tests/functional/repl: Improve precision and readability
... as well as match buildReadlineNoMarkdown. Unfortunately it doesn't support long inputs or multiline inputs for now. This needs to make better use of the interacter interface.
This commit is contained in:
parent
712ce2feac
commit
ca2cc26e12
14 changed files with 154 additions and 99 deletions
|
@ -262,6 +262,14 @@ badExitCode=0
|
|||
|
||||
nixVersion="$(nix eval --impure --raw --expr 'builtins.nixVersion' --extra-experimental-features nix-command)"
|
||||
|
||||
# I couldn't get readline and editline to agree on the newline before the prompt,
|
||||
# so let's just force it to be one empty line. Ideally we get the two to agree
|
||||
# or use a simpler interacter for testing.
|
||||
stripEmptyLinesBeforePrompt() {
|
||||
# --null-data: treat input as NUL-terminated instead of newline-terminated
|
||||
sed --null-data 's/\n\n*nix-repl>/\n\nnix-repl>/g'
|
||||
}
|
||||
|
||||
runRepl () {
|
||||
|
||||
# That is right, we are also filtering out the testdir _without underscores_.
|
||||
|
@ -273,8 +281,11 @@ runRepl () {
|
|||
testDirNoUnderscores="${testDir//_/}"
|
||||
|
||||
# TODO: pass arguments to nix repl; see lang.sh
|
||||
_NIX_TEST_RAW_MARKDOWN=1 \
|
||||
_NIX_TEST_REPL_ECHO=1 \
|
||||
nix repl 2>&1 \
|
||||
| stripColors \
|
||||
| stripEmptyLinesBeforePrompt \
|
||||
| sed \
|
||||
-e "s@$testDir@/path/to/tests/functional@g" \
|
||||
-e "s@$testDirNoUnderscores@/path/to/tests/functional@g" \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue