diff options
author | Goldstein <root@goldstein.rs> | 2024-07-15 23:28:55 +0300 |
---|---|---|
committer | Max Siling <root@goldstein.rs> | 2024-07-30 16:08:26 +0000 |
commit | 1a6d7a3af466dad946e6fc0e969927a8f246c13a (patch) | |
tree | e44d9559f2545ea233336ce6fe9f2bf91589aead /tests/functional | |
parent | 548c973e8282bbec5b14f3860218b23564dc0381 (diff) |
src/libcmd/repl.cc: avoid unneeded reload after :e
If `:edit`ing a store path, don't reload repl afterwards
to avoid losing local variables: store is immutable,
so "editing" a store path is always just viewing it.
Resolves: https://git.lix.systems/lix-project/lix/issues/341
Change-Id: I3747f75ce26e0595e953069c39ddc3ee80699718
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/repl.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/functional/repl.sh b/tests/functional/repl.sh index cd56b4d92..22c69e20b 100644 --- a/tests/functional/repl.sh +++ b/tests/functional/repl.sh @@ -244,3 +244,30 @@ testReplResponseNoRegex ' y = { a = 1; }; } ' + +# Test that editing a store path does not reload... +echo '{ identity = a: a; }' > repl-test.nix +repl_test_store="$(nix-store --add repl-test.nix)" +EDITOR=true testReplResponseNoRegex " +a = ''test string that we'll grep later'' +:l $repl_test_store +:e identity +a +" "test string that we'll grep later" + +# ...even through symlinks +ln -s "$repl_test_store" repl-test-link.nix +EDITOR=true testReplResponseNoRegex " +a = ''test string that we'll grep later'' +:l repl-test-link.nix +:e identity +a +" "test string that we'll grep later" + +# Test that editing a local file does reload +EDITOR=true testReplResponseNoRegex " +a = ''test string that we'll grep later'' +:l repl-test.nix +:e identity +a +" "undefined variable" |