summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-12-02 21:25:32 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-12-02 23:23:23 +0100
commitdf552a26452f4cdf734edcac049187b8fd806153 (patch)
tree2372afd965a6219ab34aae219d4a4b3e178c5cd4 /tests
parent148608ba6ddf93168e86525627bed755a474d21f (diff)
nix eval: Add option to write a directory
This is useful for generating the nix manpages, but it may have other applications (like generating configuration files without a Nix store).
Diffstat (limited to 'tests')
-rw-r--r--tests/pure-eval.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/pure-eval.sh b/tests/pure-eval.sh
index 43a765997..561ca53fb 100644
--- a/tests/pure-eval.sh
+++ b/tests/pure-eval.sh
@@ -16,3 +16,11 @@ nix eval --expr 'assert 1 + 2 == 3; true'
[[ $(nix eval --impure --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x") == 123 ]]
(! nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x")
nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; sha256 = \"$(nix hash-file pure-eval.nix --type sha256)\"; })).x"
+
+rm -rf $TEST_ROOT/eval-out
+nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ x = "foo" + "bar"; y = { z = "bla"; }; }'
+[[ $(cat $TEST_ROOT/eval-out/x) = foobar ]]
+[[ $(cat $TEST_ROOT/eval-out/y/z) = bla ]]
+
+rm -rf $TEST_ROOT/eval-out
+(! nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ "." = "bla"; }')