mirror of
https://github.com/NixOS/nix
synced 2025-06-29 10:31:15 +02:00
This avoids an inconsistency where a '/' is implicitly inserted when you append to the root of a source tree, but not when you append to any other path.
12 lines
700 B
Bash
12 lines
700 B
Bash
source common.sh
|
|
|
|
mkdir -p $TEST_ROOT/foo
|
|
echo bla > $TEST_ROOT/foo/bar
|
|
|
|
[[ $(nix eval --raw --impure --expr "builtins.readFile (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"/bar\"))") = bla ]]
|
|
|
|
[[ $(nix eval --raw --impure --expr "builtins.readFile (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"/b\" + \"ar\"))") = bla ]]
|
|
|
|
(! nix eval --raw --impure --expr "builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; } + \"bar\"")
|
|
|
|
[[ $(nix eval --json --impure --expr "builtins.readDir (builtins.toString (builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; }))") = '{"bar":"regular"}' ]]
|