From f061086a93400c34f19eb54f0b34637af9f0d9cb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 31 Mar 2010 13:35:29 +0000 Subject: * Fix the broken test for listToAttrs. --- tests/lang/eval-okay-listToAttrs.nix | 8 -------- tests/lang/eval-okay-listtoattrs.exp | 1 + tests/lang/eval-okay-listtoattrs.nix | 10 ++++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 tests/lang/eval-okay-listToAttrs.nix create mode 100644 tests/lang/eval-okay-listtoattrs.exp create mode 100644 tests/lang/eval-okay-listtoattrs.nix (limited to 'tests/lang') diff --git a/tests/lang/eval-okay-listToAttrs.nix b/tests/lang/eval-okay-listToAttrs.nix deleted file mode 100644 index f5eae92ccd98..000000000000 --- a/tests/lang/eval-okay-listToAttrs.nix +++ /dev/null @@ -1,8 +0,0 @@ -# this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called) -let - asi = attr: value : { inherit attr value; }; - list = [ ( asi "a" "A" ) ( asi "b" "B" ) ]; - a = builtins.listToAttrs list; - b = builtins.listToAttrs ( list ++ list ); - r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; -in r.result diff --git a/tests/lang/eval-okay-listtoattrs.exp b/tests/lang/eval-okay-listtoattrs.exp new file mode 100644 index 000000000000..49adcc16f6ba --- /dev/null +++ b/tests/lang/eval-okay-listtoattrs.exp @@ -0,0 +1 @@ +Str("AA",[]) diff --git a/tests/lang/eval-okay-listtoattrs.nix b/tests/lang/eval-okay-listtoattrs.nix new file mode 100644 index 000000000000..d5cd726b0c64 --- /dev/null +++ b/tests/lang/eval-okay-listtoattrs.nix @@ -0,0 +1,10 @@ +# this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called) +with import ./lib.nix; + +let + asi = name: value : { inherit name value; }; + list = [ ( asi "a" "A" ) ( asi "b" "B" ) ]; + a = builtins.listToAttrs list; + b = builtins.listToAttrs ( list ++ list ); + r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; +in concat (map (x: x.a) r.result) -- cgit 1.4.1