diff --git a/tests/functional2/lang/arithmetic/eval-okay.out.exp b/tests/functional2/lang/arithmetic/eval-okay.out.exp index 5c54d10b7..be8b93376 100644 --- a/tests/functional2/lang/arithmetic/eval-okay.out.exp +++ b/tests/functional2/lang/arithmetic/eval-okay.out.exp @@ -1 +1 @@ -2216 +[ 1275 579 -11 5 3 11 60 228 20 8 14 6 ] diff --git a/tests/functional2/lang/arithmetic/in.nix b/tests/functional2/lang/arithmetic/in.nix index 534e9d169..c2ac4e526 100644 --- a/tests/functional2/lang/arithmetic/in.nix +++ b/tests/functional2/lang/arithmetic/in.nix @@ -16,44 +16,44 @@ let err = abort "urgh"; in - sum - [ (sum (range 1 50)) - (123 + 456) - (0 + -10 + -(-11) + -x) - (10 - 7 - -2) - (10 - (6 - -1)) - (10 - 1 + 2) - (3 * 4 * 5) - (56088 / 123 / 2) - (3 + 4 * const 5 0 - 6 / id 2) - (builtins.bitAnd 12 10) # 0b1100 & 0b1010 = 8 - (builtins.bitOr 12 10) # 0b1100 | 0b1010 = 14 - (builtins.bitXor 12 10) # 0b1100 ^ 0b1010 = 6 +assert 3 < 7; +assert !(7 < 3); +assert !(3 < 3); - (if 3 < 7 then 1 else err) - (if 7 < 3 then err else 1) - (if 3 < 3 then err else 1) +assert 3 <= 7; +assert !(7 <= 3); +assert 3 <= 3; - (if 3 <= 7 then 1 else err) - (if 7 <= 3 then err else 1) - (if 3 <= 3 then 1 else err) +assert !(3 > 7); +assert 7 > 3; +assert !(3 > 3); - (if 3 > 7 then err else 1) - (if 7 > 3 then 1 else err) - (if 3 > 3 then err else 1) +assert !(3 >= 7); +assert 7 >= 3; +assert 3 >= 3; - (if 3 >= 7 then err else 1) - (if 7 >= 3 then 1 else err) - (if 3 >= 3 then 1 else err) +assert 2 > 1 == 1 < 2; +assert 1 + 2 * 3 >= 7; +assert !(1 + 2 * 3 < 7); - (if 2 > 1 == 1 < 2 then 1 else err) - (if 1 + 2 * 3 >= 7 then 1 else err) - (if 1 + 2 * 3 < 7 then err else 1) +# Not integer, but so what. +assert "aa" < "ab"; +assert !("aa" < "aa"); +assert "foo" < "foobar"; +[ + (sum (range 1 50)) + (123 + 456) + (0 + -10 + -(-11) + -x) + (10 - 7 - -2) + (10 - (6 - -1)) + (10 - 1 + 2) + (3 * 4 * 5) + (56088 / 123 / 2) + (3 + 4 * const 5 0 - 6 / id 2) - # Not integer, but so what. - (if "aa" < "ab" then 1 else err) - (if "aa" < "aa" then err else 1) - (if "foo" < "foobar" then 1 else err) - ] + (builtins.bitAnd 12 10) # 0b1100 & 0b1010 = 8 + (builtins.bitOr 12 10) # 0b1100 | 0b1010 = 14 + (builtins.bitXor 12 10) # 0b1100 ^ 0b1010 = 6 +] diff --git a/tests/functional2/lang/builtins.compareVersions-parseDrvName/in.nix b/tests/functional2/lang/builtins.compareVersions-parseDrvName/in.nix index e9111f5f4..cbb839f25 100644 --- a/tests/functional2/lang/builtins.compareVersions-parseDrvName/in.nix +++ b/tests/functional2/lang/builtins.compareVersions-parseDrvName/in.nix @@ -14,30 +14,28 @@ let let d1 = builtins.compareVersions v1 v2; d2 = builtins.compareVersions v2 v1; in d1 == builtins.sub 0 d2 && d1 == expected; +in - tests = [ - ((builtins.parseDrvName name1).name == "hello") - ((builtins.parseDrvName name1).version == "1.0.2") - ((builtins.parseDrvName name2).name == "hello") - ((builtins.parseDrvName name2).version == "") - ((builtins.parseDrvName name3).name == "915resolution") - ((builtins.parseDrvName name3).version == "0.5.2") - ((builtins.parseDrvName name4).name == "xf86-video-i810") - ((builtins.parseDrvName name4).version == "1.7.4") - ((builtins.parseDrvName name5).name == "name-that-ends-with-dash") - ((builtins.parseDrvName name5).version == "-1.0") - (versionTest "1.0" "2.3" lt) - (versionTest "2.1" "2.3" lt) - (versionTest "2.3" "2.3" eq) - (versionTest "2.5" "2.3" gt) - (versionTest "3.1" "2.3" gt) - (versionTest "2.3.1" "2.3" gt) - (versionTest "2.3.1" "2.3a" gt) - (versionTest "2.3pre1" "2.3" lt) - (versionTest "2.3pre3" "2.3pre12" lt) - (versionTest "2.3a" "2.3c" lt) - (versionTest "2.3pre1" "2.3c" lt) - (versionTest "2.3pre1" "2.3q" lt) - ]; - -in (import ./lib.nix).and tests +assert (builtins.parseDrvName name1).name == "hello"; +assert (builtins.parseDrvName name1).version == "1.0.2"; +assert (builtins.parseDrvName name2).name == "hello"; +assert (builtins.parseDrvName name2).version == ""; +assert (builtins.parseDrvName name3).name == "915resolution"; +assert (builtins.parseDrvName name3).version == "0.5.2"; +assert (builtins.parseDrvName name4).name == "xf86-video-i810"; +assert (builtins.parseDrvName name4).version == "1.7.4"; +assert (builtins.parseDrvName name5).name == "name-that-ends-with-dash"; +assert (builtins.parseDrvName name5).version == "-1.0"; +assert versionTest "1.0" "2.3" lt; +assert versionTest "2.1" "2.3" lt; +assert versionTest "2.3" "2.3" eq; +assert versionTest "2.5" "2.3" gt; +assert versionTest "3.1" "2.3" gt; +assert versionTest "2.3.1" "2.3" gt; +assert versionTest "2.3.1" "2.3a" gt; +assert versionTest "2.3pre1" "2.3" lt; +assert versionTest "2.3pre3" "2.3pre12" lt; +assert versionTest "2.3a" "2.3c" lt; +assert versionTest "2.3pre1" "2.3c" lt; +assert versionTest "2.3pre1" "2.3q" lt; +true diff --git a/tests/functional2/lang/builtins.floor-ceil/eval-okay.out.exp b/tests/functional2/lang/builtins.floor-ceil/eval-okay.out.exp index 81f80420b..193681924 100644 --- a/tests/functional2/lang/builtins.floor-ceil/eval-okay.out.exp +++ b/tests/functional2/lang/builtins.floor-ceil/eval-okay.out.exp @@ -1 +1 @@ -"23;24;23;23" +[ "23" "24" "23" "23" ] diff --git a/tests/functional2/lang/builtins.floor-ceil/in.nix b/tests/functional2/lang/builtins.floor-ceil/in.nix index d76a0d86e..669c8ae9c 100644 --- a/tests/functional2/lang/builtins.floor-ceil/in.nix +++ b/tests/functional2/lang/builtins.floor-ceil/in.nix @@ -6,4 +6,4 @@ let n3 = builtins.floor 23; n4 = builtins.ceil 23; in - builtins.concatStringsSep ";" (map toString [ n1 n2 n3 n4 ]) +map toString [ n1 n2 n3 n4 ] diff --git a/tests/functional2/lang/builtins.listToAttrs/eval-okay.out.exp b/tests/functional2/lang/builtins.listToAttrs/eval-okay.out.exp index 74abef7bc..aabcfee52 100644 --- a/tests/functional2/lang/builtins.listToAttrs/eval-okay.out.exp +++ b/tests/functional2/lang/builtins.listToAttrs/eval-okay.out.exp @@ -1 +1 @@ -"AAbar" +[ "A" "A" "bar" ] diff --git a/tests/functional2/lang/builtins.listToAttrs/in.nix b/tests/functional2/lang/builtins.listToAttrs/in.nix index 53b9a0e96..f7e67f14e 100644 --- a/tests/functional2/lang/builtins.listToAttrs/in.nix +++ b/tests/functional2/lang/builtins.listToAttrs/in.nix @@ -7,4 +7,4 @@ let r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; x = builtins.listToAttrs [ (asi "foo" "bar") (asi "foo" "bla") ]; in -builtins.concatStringsSep "" (map (x: x.a) r.result) + x.foo +(map (x: x.a) r.result) ++ [ x.foo ] diff --git a/tests/functional2/lang/builtins.map/eval-okay.out.exp b/tests/functional2/lang/builtins.map/eval-okay.out.exp index dbb64f717..34b26c346 100644 --- a/tests/functional2/lang/builtins.map/eval-okay.out.exp +++ b/tests/functional2/lang/builtins.map/eval-okay.out.exp @@ -1 +1 @@ -"foobarblabarxyzzybar" +[ "foobar" "blabar" "xyzzybar" ] diff --git a/tests/functional2/lang/builtins.map/in.nix b/tests/functional2/lang/builtins.map/in.nix index e5bbf1ce5..fbea9d772 100644 --- a/tests/functional2/lang/builtins.map/in.nix +++ b/tests/functional2/lang/builtins.map/in.nix @@ -1 +1 @@ -builtins.concatStringsSep "" (map (x: x + "bar") [ "foo" "bla" "xyzzy" ]) +map (x: x + "bar") [ "foo" "bla" "xyzzy" ] diff --git a/tests/functional2/lang/builtins.pathExists/in.nix b/tests/functional2/lang/builtins.pathExists/in.nix index d00e05aae..5c052e474 100644 --- a/tests/functional2/lang/builtins.pathExists/in.nix +++ b/tests/functional2/lang/builtins.pathExists/in.nix @@ -1,32 +1,33 @@ -builtins.pathExists (./lib.nix) -&& builtins.pathExists (builtins.toPath ./lib.nix) -&& builtins.pathExists (builtins.toString ./lib.nix) -&& !builtins.pathExists (builtins.toString ./lib.nix + "/") -&& !builtins.pathExists (builtins.toString ./lib.nix + "/.") +assert builtins.pathExists (./lib.nix); +assert builtins.pathExists (builtins.toPath ./lib.nix); +assert builtins.pathExists (builtins.toString ./lib.nix); +assert !builtins.pathExists (builtins.toString ./lib.nix + "/"); +assert !builtins.pathExists (builtins.toString ./lib.nix + "/."); # FIXME -# && !builtins.pathExists (builtins.toString ./lib.nix + "/..") -# && !builtins.pathExists (builtins.toString ./lib.nix + "/a/..") -# && !builtins.pathExists (builtins.toString ./lib.nix + "/../lib.nix") -&& !builtins.pathExists (builtins.toString ./lib.nix + "/./") -&& !builtins.pathExists (builtins.toString ./lib.nix + "/./.") -&& builtins.pathExists (builtins.toString ./.. + "/test-home/lib.nix") -&& !builtins.pathExists (builtins.toString ./.. + "test-home/lib.nix") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/lib.nix") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/./lib.nix") -&& builtins.pathExists (builtins.toString ./.) -&& builtins.pathExists (builtins.toString ./. + "/") -&& builtins.pathExists (builtins.toString ./. + "/../test-home") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/.") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/./") -&& builtins.pathExists (builtins.toString ./. + "/../test-home//./") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/..") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/../") -&& builtins.pathExists (builtins.toString ./. + "/../test-home/..//") -&& builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix)) -&& !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix)) -&& builtins.pathExists ./lib.nix -&& !builtins.pathExists ./bla.nix -&& builtins.pathExists ./symlink-resolution/foo/overlays/overlay.nix -&& builtins.pathExists ./symlink-resolution/broken -&& builtins.pathExists (builtins.toString ./symlink-resolution/foo/overlays + "/.") +# assert !builtins.pathExists (builtins.toString ./lib.nix + "/.."); +# assert !builtins.pathExists (builtins.toString ./lib.nix + "/a/.."); +# assert !builtins.pathExists (builtins.toString ./lib.nix + "/../lib.nix"); +assert !builtins.pathExists (builtins.toString ./lib.nix + "/./"); +assert !builtins.pathExists (builtins.toString ./lib.nix + "/./."); +assert builtins.pathExists (builtins.toString ./.. + "/test-home/lib.nix"); +assert !builtins.pathExists (builtins.toString ./.. + "test-home/lib.nix"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/lib.nix"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/./lib.nix"); +assert builtins.pathExists (builtins.toString ./.); +assert builtins.pathExists (builtins.toString ./. + "/"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/."); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/./"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home//./"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/.."); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/../"); +assert builtins.pathExists (builtins.toString ./. + "/../test-home/..//"); +assert builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix)); +assert !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix)); +assert builtins.pathExists ./lib.nix; +assert !builtins.pathExists ./bla.nix; +assert builtins.pathExists ./symlink-resolution/foo/overlays/overlay.nix; +assert builtins.pathExists ./symlink-resolution/broken; +assert builtins.pathExists (builtins.toString ./symlink-resolution/foo/overlays + "/."); +true diff --git a/tests/functional2/lang/builtins.substring/eval-okay-2.out.exp b/tests/functional2/lang/builtins.substring/eval-okay-2.out.exp index f48b4623a..8b9a0f789 100644 --- a/tests/functional2/lang/builtins.substring/eval-okay-2.out.exp +++ b/tests/functional2/lang/builtins.substring/eval-okay-2.out.exp @@ -1 +1 @@ -"ooxfoobarybarzobaabbc_bad" +[ "oo" "foobar" "bar" "oba" "" "b" "" "bad" ] diff --git a/tests/functional2/lang/builtins.substring/in-2.nix b/tests/functional2/lang/builtins.substring/in-2.nix index 54c97e162..bba0b44b1 100644 --- a/tests/functional2/lang/builtins.substring/in-2.nix +++ b/tests/functional2/lang/builtins.substring/in-2.nix @@ -5,19 +5,13 @@ let s = "foobar"; in - -substring 1 2 s -+ "x" -+ substring 0 (stringLength s) s -+ "y" -+ substring 3 100 s -+ "z" -+ substring 2 (sub (stringLength s) 3) s -+ "a" -+ substring 3 0 s -+ "b" -+ substring 3 1 s -+ "c" -+ substring 5 10 "perl" -+ "_" -+ substring 3 (-1) "tebbad" +[ + (substring 1 2 s) + (substring 0 (stringLength s) s) + (substring 3 100 s) + (substring 2 (sub (stringLength s) 3) s) + (substring 3 0 s) + (substring 3 1 s) + (substring 5 10 "perl") + (substring 3 (-1) "tebbad") +] \ No newline at end of file diff --git a/tests/functional2/lang/function-args/eval-okay-formals.out.exp b/tests/functional2/lang/function-args/eval-okay-formals.out.exp index a4304010f..14a08c188 100644 --- a/tests/functional2/lang/function-args/eval-okay-formals.out.exp +++ b/tests/functional2/lang/function-args/eval-okay-formals.out.exp @@ -1 +1 @@ -"abcxyzDDDDEFijk" +[ "abc" "xyz" "DDD" "DEF" "ijk" ] diff --git a/tests/functional2/lang/function-args/in-formals.nix b/tests/functional2/lang/function-args/in-formals.nix index 96fd25a01..24e0ef7f9 100644 --- a/tests/functional2/lang/function-args/in-formals.nix +++ b/tests/functional2/lang/function-args/in-formals.nix @@ -9,8 +9,10 @@ let j = {x, y, z, ...}: x + y + z; in - f {x = "a"; y = "b"; z = "c";} + - g {x = "x"; y = "y"; z = "z";} + - h {x = "D";} + - h {x = "D"; y = "E"; z = "F";} + - j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";} +[ + (f {x = "a"; y = "b"; z = "c";}) + (g {x = "x"; y = "y"; z = "z";}) + (h {x = "D";}) + (h {x = "D"; y = "E"; z = "F";}) + (j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";}) +] diff --git a/tests/functional2/lang/list/eval-okay.out.exp b/tests/functional2/lang/list/eval-okay.out.exp index f784f26d8..f098638c0 100644 --- a/tests/functional2/lang/list/eval-okay.out.exp +++ b/tests/functional2/lang/list/eval-okay.out.exp @@ -1 +1 @@ -"foobarblatest" +[ "foo" "bar" "bla" "test" ] diff --git a/tests/functional2/lang/list/in.nix b/tests/functional2/lang/list/in.nix index 627c37311..353836082 100644 --- a/tests/functional2/lang/list/in.nix +++ b/tests/functional2/lang/list/in.nix @@ -1 +1 @@ -builtins.concatStringsSep "" ["foo" "bar" "bla" "test"] +["foo" "bar" "bla" "test"] diff --git a/tests/functional2/lang/search-path/eval-okay.out.exp b/tests/functional2/lang/search-path/eval-okay.out.exp index 4519bc406..763be6295 100644 --- a/tests/functional2/lang/search-path/eval-okay.out.exp +++ b/tests/functional2/lang/search-path/eval-okay.out.exp @@ -1 +1 @@ -"abccX" +[ "a" "b" "c" "c" "X" ] diff --git a/tests/functional2/lang/search-path/in.nix b/tests/functional2/lang/search-path/in.nix index 6fe33decc..b79d0fea9 100644 --- a/tests/functional2/lang/search-path/in.nix +++ b/tests/functional2/lang/search-path/in.nix @@ -6,5 +6,11 @@ assert isFunction (import ); assert length __nixPath == 5; assert length (filter (x: baseNameOf x.path == "dir4") __nixPath) == 1; -import + import + import + import - + (let __nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import ) +[ + (import ) + (import ) + (import ) + (import ) + (let __nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import ) +] + diff --git a/tests/functional2/lang/string-indented/eval-okay.out.exp b/tests/functional2/lang/string-indented/eval-okay.out.exp index 1531af0f4..726cbc0bf 100644 --- a/tests/functional2/lang/string-indented/eval-okay.out.exp +++ b/tests/functional2/lang/string-indented/eval-okay.out.exp @@ -1 +1 @@ -"This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', \${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: \${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\ncut -d $'\\t' -f 1\nending dollar $$\n Lines without any indentation effectively disable the indentation\n stripping for the entire string:\n\n cat >$out/foo/data <$out/foo/data <