From 0a8888d1c7220eddba40895a9c6c63d06edf4614 Mon Sep 17 00:00:00 2001 From: piegames Date: Sun, 18 Aug 2024 17:28:04 +0200 Subject: treewide: Stop using ancient let syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shows for how long these tests have not been touched by anyone … Change-Id: I3d0c1209a86283ddb012db4e7d45073264fdd0eb --- tests/functional/lang/eval-fail-assert.err.exp | 25 ++++++---------- tests/functional/lang/eval-fail-assert.nix | 7 ++--- tests/functional/lang/eval-fail-blackhole.err.exp | 18 ++++-------- tests/functional/lang/eval-fail-blackhole.nix | 6 ++-- tests/functional/lang/eval-fail-remove.err.exp | 18 ++++-------- tests/functional/lang/eval-fail-remove.nix | 7 ++--- tests/functional/lang/eval-fail-scope-5.err.exp | 33 +++++++++------------- tests/functional/lang/eval-fail-scope-5.nix | 9 ++---- tests/functional/lang/eval-okay-arithmetic.nix | 8 +++--- tests/functional/lang/eval-okay-attrs.nix | 11 +++++--- tests/functional/lang/eval-okay-attrs2.nix | 11 ++++---- tests/functional/lang/eval-okay-builtins.nix | 7 ++--- tests/functional/lang/eval-okay-flatten.nix | 6 ++-- tests/functional/lang/eval-okay-list.nix | 6 +--- tests/functional/lang/eval-okay-remove.nix | 7 ++--- tests/functional/lang/eval-okay-scope-4.nix | 9 ++---- tests/functional/lang/eval-okay-scope-6.nix | 8 ++---- tests/functional/lang/eval-okay-with.nix | 6 ++-- tests/functional/lang/parse-fail-dup-attrs-2.nix | 4 +-- tests/functional/lang/parse-fail-dup-attrs-3.nix | 4 +-- .../lang/parse-fail-regression-20060610.err.exp | 10 +++---- .../lang/parse-fail-regression-20060610.nix | 11 ++++---- tests/functional/lang/parse-fail-undef-var-2.nix | 7 ++--- 23 files changed, 97 insertions(+), 141 deletions(-) (limited to 'tests') diff --git a/tests/functional/lang/eval-fail-assert.err.exp b/tests/functional/lang/eval-fail-assert.err.exp index 0656ec81c..4bb63c29a 100644 --- a/tests/functional/lang/eval-fail-assert.err.exp +++ b/tests/functional/lang/eval-fail-assert.err.exp @@ -1,28 +1,21 @@ error: - … while evaluating the attribute 'body' - at /pwd/lang/eval-fail-assert.nix:4:3: - 3| - 4| body = x "x"; - | ^ - 5| } - … from call site - at /pwd/lang/eval-fail-assert.nix:4:10: - 3| - 4| body = x "x"; - | ^ - 5| } + at /pwd/lang/eval-fail-assert.nix:4:1: + 3| in + 4| x "x" + | ^ + 5| … while calling 'x' at /pwd/lang/eval-fail-assert.nix:2:7: - 1| let { + 1| let 2| x = arg: assert arg == "y"; 123; | ^ - 3| + 3| in error: assertion '(arg == "y")' failed at /pwd/lang/eval-fail-assert.nix:2:12: - 1| let { + 1| let 2| x = arg: assert arg == "y"; 123; | ^ - 3| + 3| in diff --git a/tests/functional/lang/eval-fail-assert.nix b/tests/functional/lang/eval-fail-assert.nix index 3b7a1e8bf..405adedbd 100644 --- a/tests/functional/lang/eval-fail-assert.nix +++ b/tests/functional/lang/eval-fail-assert.nix @@ -1,5 +1,4 @@ -let { +let x = arg: assert arg == "y"; 123; - - body = x "x"; -} \ No newline at end of file +in +x "x" diff --git a/tests/functional/lang/eval-fail-blackhole.err.exp b/tests/functional/lang/eval-fail-blackhole.err.exp index 95e33a5fe..91fd293f3 100644 --- a/tests/functional/lang/eval-fail-blackhole.err.exp +++ b/tests/functional/lang/eval-fail-blackhole.err.exp @@ -1,14 +1,6 @@ -error: - … while evaluating the attribute 'body' - at /pwd/lang/eval-fail-blackhole.nix:2:3: - 1| let { - 2| body = x; - | ^ - 3| x = y; - - error: infinite recursion encountered - at /pwd/lang/eval-fail-blackhole.nix:3:7: - 2| body = x; - 3| x = y; +error: infinite recursion encountered + at /pwd/lang/eval-fail-blackhole.nix:2:7: + 1| let + 2| x = y; | ^ - 4| y = x; + 3| y = x; diff --git a/tests/functional/lang/eval-fail-blackhole.nix b/tests/functional/lang/eval-fail-blackhole.nix index 81133b511..f7519a89b 100644 --- a/tests/functional/lang/eval-fail-blackhole.nix +++ b/tests/functional/lang/eval-fail-blackhole.nix @@ -1,5 +1,5 @@ -let { - body = x; +let x = y; y = x; -} +in +x diff --git a/tests/functional/lang/eval-fail-remove.err.exp b/tests/functional/lang/eval-fail-remove.err.exp index 292b3c3f3..0ae9c1256 100644 --- a/tests/functional/lang/eval-fail-remove.err.exp +++ b/tests/functional/lang/eval-fail-remove.err.exp @@ -1,15 +1,7 @@ -error: - … while evaluating the attribute 'body' - at /pwd/lang/eval-fail-remove.nix:4:3: - 3| - 4| body = (removeAttrs attrs ["x"]).x; +error: attribute 'x' missing + at /pwd/lang/eval-fail-remove.nix:4:3: + 3| in + 4| (removeAttrs attrs ["x"]).x | ^ - 5| } - - error: attribute 'x' missing - at /pwd/lang/eval-fail-remove.nix:4:10: - 3| - 4| body = (removeAttrs attrs ["x"]).x; - | ^ - 5| } + 5| Did you mean y? diff --git a/tests/functional/lang/eval-fail-remove.nix b/tests/functional/lang/eval-fail-remove.nix index 539e0eb0a..3ea7b1c86 100644 --- a/tests/functional/lang/eval-fail-remove.nix +++ b/tests/functional/lang/eval-fail-remove.nix @@ -1,5 +1,4 @@ -let { +let attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).x; -} \ No newline at end of file +in + (removeAttrs attrs ["x"]).x diff --git a/tests/functional/lang/eval-fail-scope-5.err.exp b/tests/functional/lang/eval-fail-scope-5.err.exp index b0b05cad7..4dcfb5321 100644 --- a/tests/functional/lang/eval-fail-scope-5.err.exp +++ b/tests/functional/lang/eval-fail-scope-5.err.exp @@ -1,28 +1,21 @@ error: - … while evaluating the attribute 'body' - at /pwd/lang/eval-fail-scope-5.nix:8:3: - 7| - 8| body = f {}; - | ^ - 9| - … from call site - at /pwd/lang/eval-fail-scope-5.nix:8:10: - 7| - 8| body = f {}; - | ^ - 9| + at /pwd/lang/eval-fail-scope-5.nix:7:3: + 6| in + 7| f {} + | ^ + 8| … while calling 'f' - at /pwd/lang/eval-fail-scope-5.nix:6:7: - 5| - 6| f = {x ? y, y ? x}: x + y; + at /pwd/lang/eval-fail-scope-5.nix:5:7: + 4| + 5| f = {x ? y, y ? x}: x + y; | ^ - 7| + 6| in error: infinite recursion encountered - at /pwd/lang/eval-fail-scope-5.nix:6:12: - 5| - 6| f = {x ? y, y ? x}: x + y; + at /pwd/lang/eval-fail-scope-5.nix:5:12: + 4| + 5| f = {x ? y, y ? x}: x + y; | ^ - 7| + 6| in diff --git a/tests/functional/lang/eval-fail-scope-5.nix b/tests/functional/lang/eval-fail-scope-5.nix index f89a65a99..dd98246b5 100644 --- a/tests/functional/lang/eval-fail-scope-5.nix +++ b/tests/functional/lang/eval-fail-scope-5.nix @@ -1,10 +1,7 @@ -let { - +let x = "a"; y = "b"; f = {x ? y, y ? x}: x + y; - - body = f {}; - -} +in + f {} diff --git a/tests/functional/lang/eval-okay-arithmetic.nix b/tests/functional/lang/eval-okay-arithmetic.nix index 7e9e6a0b6..534e9d169 100644 --- a/tests/functional/lang/eval-okay-arithmetic.nix +++ b/tests/functional/lang/eval-okay-arithmetic.nix @@ -1,6 +1,6 @@ with import ./lib.nix; -let { +let /* Supposedly tail recursive version: @@ -15,7 +15,8 @@ let { err = abort "urgh"; - body = sum +in + sum [ (sum (range 1 50)) (123 + 456) (0 + -10 + -(-11) + -x) @@ -54,6 +55,5 @@ let { (if "aa" < "ab" then 1 else err) (if "aa" < "aa" then err else 1) (if "foo" < "foobar" then 1 else err) - ]; + ] -} diff --git a/tests/functional/lang/eval-okay-attrs.nix b/tests/functional/lang/eval-okay-attrs.nix index 810b31a5d..7d5c04583 100644 --- a/tests/functional/lang/eval-okay-attrs.nix +++ b/tests/functional/lang/eval-okay-attrs.nix @@ -1,5 +1,8 @@ -let { +let as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; - - body = if as ? a then as.a else assert as ? z; as.z; -} +in +if as ? a then + as.a +else + assert as ? z; + as.z diff --git a/tests/functional/lang/eval-okay-attrs2.nix b/tests/functional/lang/eval-okay-attrs2.nix index 9e06b83ac..925dc1859 100644 --- a/tests/functional/lang/eval-okay-attrs2.nix +++ b/tests/functional/lang/eval-okay-attrs2.nix @@ -1,10 +1,11 @@ -let { +let as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; A = "a"; Z = "z"; - body = if builtins.hasAttr A as - then builtins.getAttr A as - else assert builtins.hasAttr Z as; builtins.getAttr Z as; -} +in +if builtins.hasAttr A as then + builtins.getAttr A as +else + assert builtins.hasAttr Z as; builtins.getAttr Z as diff --git a/tests/functional/lang/eval-okay-builtins.nix b/tests/functional/lang/eval-okay-builtins.nix index e9d65e88a..551eb3517 100644 --- a/tests/functional/lang/eval-okay-builtins.nix +++ b/tests/functional/lang/eval-okay-builtins.nix @@ -1,12 +1,11 @@ assert builtins ? currentSystem; assert !builtins ? __currentSystem; -let { +let x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; y = if builtins ? fnord then builtins.fnord "foo" else ""; - body = x + y; - -} +in +x + y diff --git a/tests/functional/lang/eval-okay-flatten.nix b/tests/functional/lang/eval-okay-flatten.nix index fe911e968..b1fb0f878 100644 --- a/tests/functional/lang/eval-okay-flatten.nix +++ b/tests/functional/lang/eval-okay-flatten.nix @@ -1,8 +1,8 @@ with import ./lib.nix; -let { +let l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"]; - body = concat (flatten l); -} +in +concat (flatten l) diff --git a/tests/functional/lang/eval-okay-list.nix b/tests/functional/lang/eval-okay-list.nix index d433bcf90..eb6e60f23 100644 --- a/tests/functional/lang/eval-okay-list.nix +++ b/tests/functional/lang/eval-okay-list.nix @@ -1,7 +1,3 @@ with import ./lib.nix; -let { - - body = concat ["foo" "bar" "bla" "test"]; - -} \ No newline at end of file +concat ["foo" "bar" "bla" "test"] diff --git a/tests/functional/lang/eval-okay-remove.nix b/tests/functional/lang/eval-okay-remove.nix index 4ad5ba897..c2e06b3d2 100644 --- a/tests/functional/lang/eval-okay-remove.nix +++ b/tests/functional/lang/eval-okay-remove.nix @@ -1,5 +1,4 @@ -let { +let attrs = {x = 123; y = 456;}; - - body = (removeAttrs attrs ["x"]).y; -} \ No newline at end of file +in +(removeAttrs attrs ["x"]).y diff --git a/tests/functional/lang/eval-okay-scope-4.nix b/tests/functional/lang/eval-okay-scope-4.nix index dc8243bc8..c1e4e6683 100644 --- a/tests/functional/lang/eval-okay-scope-4.nix +++ b/tests/functional/lang/eval-okay-scope-4.nix @@ -1,10 +1,7 @@ -let { - +let x = "a"; y = "b"; f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} +in +f {x = "c";} + f {y = "d";} diff --git a/tests/functional/lang/eval-okay-scope-6.nix b/tests/functional/lang/eval-okay-scope-6.nix index 0995d4e7e..1cd338cda 100644 --- a/tests/functional/lang/eval-okay-scope-6.nix +++ b/tests/functional/lang/eval-okay-scope-6.nix @@ -1,7 +1,5 @@ -let { +let f = {x ? y, y ? x}: x + y; - - body = f {x = "c";} + f {y = "d";}; - -} +in +f {x = "c";} + f {y = "d";} diff --git a/tests/functional/lang/eval-okay-with.nix b/tests/functional/lang/eval-okay-with.nix index 033e8d3ab..a17d0e7b9 100644 --- a/tests/functional/lang/eval-okay-with.nix +++ b/tests/functional/lang/eval-okay-with.nix @@ -1,4 +1,4 @@ -let { +let a = "xyzzy"; @@ -15,5 +15,5 @@ let { y = with as; with bs; a + b; - body = x + y; -} +in +x + y diff --git a/tests/functional/lang/parse-fail-dup-attrs-2.nix b/tests/functional/lang/parse-fail-dup-attrs-2.nix index 864d9865e..2b3b4ccde 100644 --- a/tests/functional/lang/parse-fail-dup-attrs-2.nix +++ b/tests/functional/lang/parse-fail-dup-attrs-2.nix @@ -1,4 +1,4 @@ -let { +rec { as = { x = 123; @@ -9,5 +9,5 @@ let { x = 789; inherit (as) x; }; - + } diff --git a/tests/functional/lang/parse-fail-dup-attrs-3.nix b/tests/functional/lang/parse-fail-dup-attrs-3.nix index 114d19779..732fbf9e7 100644 --- a/tests/functional/lang/parse-fail-dup-attrs-3.nix +++ b/tests/functional/lang/parse-fail-dup-attrs-3.nix @@ -1,4 +1,4 @@ -let { +rec { as = { x = 123; @@ -9,5 +9,5 @@ let { x = 789; inherit (as) x; }; - + } diff --git a/tests/functional/lang/parse-fail-regression-20060610.err.exp b/tests/functional/lang/parse-fail-regression-20060610.err.exp index 6ae7c01bf..59fa1f08f 100644 --- a/tests/functional/lang/parse-fail-regression-20060610.err.exp +++ b/tests/functional/lang/parse-fail-regression-20060610.err.exp @@ -1,6 +1,6 @@ error: undefined variable 'gcc' - at «stdin»:9:13: - 8| body = ({ - 9| inherit gcc; - | ^ - 10| }).gcc; + at «stdin»:9:11: + 8| ({ + 9| inherit gcc; + | ^ + 10| }).gcc diff --git a/tests/functional/lang/parse-fail-regression-20060610.nix b/tests/functional/lang/parse-fail-regression-20060610.nix index b1934f7e1..b5f4a2682 100644 --- a/tests/functional/lang/parse-fail-regression-20060610.nix +++ b/tests/functional/lang/parse-fail-regression-20060610.nix @@ -1,11 +1,10 @@ -let { +let x = {gcc}: { inherit gcc; }; - - body = ({ - inherit gcc; - }).gcc; -} +in +({ + inherit gcc; +}).gcc diff --git a/tests/functional/lang/parse-fail-undef-var-2.nix b/tests/functional/lang/parse-fail-undef-var-2.nix index c10a52b1e..c2e959495 100644 --- a/tests/functional/lang/parse-fail-undef-var-2.nix +++ b/tests/functional/lang/parse-fail-undef-var-2.nix @@ -1,7 +1,6 @@ -let { +let f = {x, y : ["baz" "bar" z "bat"]}: x + y; - body = f {x = "foo"; y = "bar";}; - -} +in +f {x = "foo"; y = "bar";} -- cgit v1.2.3