1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

* More missing constructs.

This commit is contained in:
Eelco Dolstra 2010-04-12 21:21:24 +00:00
parent 4d6ad5be17
commit a60317f20f
6 changed files with 161 additions and 138 deletions

View file

@ -45,6 +45,7 @@ void run(Strings args)
doTest(state, "({x, y, ...}@args: args.z) { x = 1; y = 2; z = 3; }");
//doTest(state, "({x ? y, y ? x}: y) { }");
doTest(state, "let x = 1; in x");
doTest(state, "let { x = 1; body = x; }");
doTest(state, "with { x = 1; }; x");
doTest(state, "let x = 2; in with { x = 1; }; x"); // => 2
doTest(state, "with { x = 1; }; with { x = 2; }; x"); // => 1
@ -65,18 +66,19 @@ void run(Strings args)
doTest(state, "__head [ 1 2 3 ]");
doTest(state, "__add 1 2");
doTest(state, "null");
//doTest(state, "\"foo\"");
//doTest(state, "let s = \"bar\"; in \"foo${s}\"");
doTest(state, "\"foo\"");
doTest(state, "let s = \"bar\"; in \"foo${s}\"");
doTest(state, "if true then 1 else 2");
doTest(state, "if false then 1 else 2");
doTest(state, "if false || true then 1 else 2");
doTest(state, "!(true || false)");
doTest(state, "let x = x; in if true || x then 1 else 2");
doTest(state, "http://nixos.org/");
doTest(state, "/etc/passwd");
//doTest(state, "import ./foo.nix");
doTest(state, "map (x: __add 1 x) [ 1 2 3 ]");
doTest(state, "map (builtins.add 1) [ 1 2 3 ]");
//doTest(state, "builtins.hasAttr \"x\" { x = 1; }");
doTest(state, "builtins.hasAttr \"x\" { x = 1; }");
doTest(state, "let x = 1; as = rec { inherit x; y = as.x; }; in as.y");
doTest(state, "let as = { x = 1; }; bs = rec { inherit (as) x; y = x; }; in bs.y");
doTest(state, "let as = rec { inherit (y) x; y = { x = 1; }; }; in as.x");