aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-21 21:18:52 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-21 21:18:52 +0100
commit6fadb3fc03a1a3d51a1aaea003bfbe347c3879b3 (patch)
tree2bd6687cc2c2cb83a9ed4666ed06afb5c8a967ec /tests
parent62f712c8aedc08d6478ce9b380a2cf317d7e4d3a (diff)
parentaef635da78d33bf679f49fd10e7130d918a82549 (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/eval-okay-fromjson-escapes.exp1
-rw-r--r--tests/lang/eval-okay-fromjson-escapes.nix3
-rw-r--r--tests/structured-attrs.nix6
-rw-r--r--tests/structured-attrs.sh5
4 files changed, 12 insertions, 3 deletions
diff --git a/tests/lang/eval-okay-fromjson-escapes.exp b/tests/lang/eval-okay-fromjson-escapes.exp
new file mode 100644
index 000000000..add5505a8
--- /dev/null
+++ b/tests/lang/eval-okay-fromjson-escapes.exp
@@ -0,0 +1 @@
+"quote \" reverse solidus \\ solidus / backspace  formfeed newline \n carriage return \r horizontal tab \t 1 char unicode encoded backspace  1 char unicode encoded e with accent é 2 char unicode encoded s with caron š 3 char unicode encoded rightwards arrow →"
diff --git a/tests/lang/eval-okay-fromjson-escapes.nix b/tests/lang/eval-okay-fromjson-escapes.nix
new file mode 100644
index 000000000..f00713507
--- /dev/null
+++ b/tests/lang/eval-okay-fromjson-escapes.nix
@@ -0,0 +1,3 @@
+# This string contains all supported escapes in a JSON string, per json.org
+# \b and \f are not supported by Nix
+builtins.fromJSON ''"quote \" reverse solidus \\ solidus \/ backspace \b formfeed \f newline \n carriage return \r horizontal tab \t 1 char unicode encoded backspace \u0008 1 char unicode encoded e with accent \u00e9 2 char unicode encoded s with caron \u0161 3 char unicode encoded rightwards arrow \u2192"''
diff --git a/tests/structured-attrs.nix b/tests/structured-attrs.nix
index 6c77a4391..c39c3a346 100644
--- a/tests/structured-attrs.nix
+++ b/tests/structured-attrs.nix
@@ -16,6 +16,8 @@ mkDerivation {
__structuredAttrs = true;
+ outputs = [ "out" "dev" ];
+
buildCommand = ''
set -x
@@ -30,8 +32,9 @@ mkDerivation {
[[ -v nothing ]]
[[ -z $nothing ]]
- mkdir ''${outputs[out]}
+ mkdir ''${outputs[out]} ''${outputs[dev]}
echo bar > $dest
+ echo foo > $dest2
json=$(cat .attrs.json)
[[ $json =~ '"narHash":"sha256:1r7yc43zqnzl5b0als5vnyp649gk17i37s7mj00xr8kc47rjcybk"' ]]
@@ -57,6 +60,7 @@ mkDerivation {
nothing = null;
dest = "${placeholder "out"}/foo";
+ dest2 = "${placeholder "dev"}/foo";
"foo bar" = "BAD";
"1foobar" = "BAD";
diff --git a/tests/structured-attrs.sh b/tests/structured-attrs.sh
index 9ba2672b6..646bdb876 100644
--- a/tests/structured-attrs.sh
+++ b/tests/structured-attrs.sh
@@ -2,6 +2,7 @@ source common.sh
clearStore
-outPath=$(nix-build structured-attrs.nix --no-out-link)
+nix-build structured-attrs.nix -A all -o $TEST_ROOT/result
-[[ $(cat $outPath/foo) = bar ]]
+[[ $(cat $TEST_ROOT/result/foo) = bar ]]
+[[ $(cat $TEST_ROOT/result-dev/foo) = foo ]]