aboutsummaryrefslogtreecommitdiff
path: root/bin/tests/data
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tests/data')
-rw-r--r--bin/tests/data/bool_comparison.nix13
-rw-r--r--bin/tests/data/collapsible_let_in.nix9
-rw-r--r--bin/tests/data/deprecated_is_null.nix6
-rw-r--r--bin/tests/data/empty_let_in.nix3
-rw-r--r--bin/tests/data/empty_pattern.nix9
-rw-r--r--bin/tests/data/eta_reduction.nix18
-rw-r--r--bin/tests/data/legacy_let_syntax.nix5
-rw-r--r--bin/tests/data/manual_inherit.nix12
-rw-r--r--bin/tests/data/manual_inherit_from.nix8
-rw-r--r--bin/tests/data/redundant_pattern_bind.nix1
-rw-r--r--bin/tests/data/unquoted_splices.nix15
-rw-r--r--bin/tests/data/unquoted_uri.nix1
-rw-r--r--bin/tests/data/useless_parens.nix16
13 files changed, 116 insertions, 0 deletions
diff --git a/bin/tests/data/bool_comparison.nix b/bin/tests/data/bool_comparison.nix
new file mode 100644
index 0000000..dee2d08
--- /dev/null
+++ b/bin/tests/data/bool_comparison.nix
@@ -0,0 +1,13 @@
1[
2 # trivial
3 (a == true)
4 (b == true)
5 (true == c)
6 (true == d)
7
8 # not equals
9 (e != true)
10 (f != false)
11 (true != g)
12 (false != h)
13]
diff --git a/bin/tests/data/collapsible_let_in.nix b/bin/tests/data/collapsible_let_in.nix
new file mode 100644
index 0000000..7b41014
--- /dev/null
+++ b/bin/tests/data/collapsible_let_in.nix
@@ -0,0 +1,9 @@
1let
2 a = 2;
3 b = 3;
4in
5 let
6 c = 5;
7 d = 6;
8 in
9 a + b + c + d
diff --git a/bin/tests/data/deprecated_is_null.nix b/bin/tests/data/deprecated_is_null.nix
new file mode 100644
index 0000000..42596d7
--- /dev/null
+++ b/bin/tests/data/deprecated_is_null.nix
@@ -0,0 +1,6 @@
1let
2 e = null;
3in
4if isNull e
5then "no"
6else "yes"
diff --git a/bin/tests/data/empty_let_in.nix b/bin/tests/data/empty_let_in.nix
new file mode 100644
index 0000000..3ecb6e4
--- /dev/null
+++ b/bin/tests/data/empty_let_in.nix
@@ -0,0 +1,3 @@
1let
2in
3 null
diff --git a/bin/tests/data/empty_pattern.nix b/bin/tests/data/empty_pattern.nix
new file mode 100644
index 0000000..23d99e8
--- /dev/null
+++ b/bin/tests/data/empty_pattern.nix
@@ -0,0 +1,9 @@
1[
2 # match
3 ({ ... }: 42)
4
5 # don't match
6 ({ a, ... }: a)
7 ({ ... } @ inputs: inputs)
8]
9
diff --git a/bin/tests/data/eta_reduction.nix b/bin/tests/data/eta_reduction.nix
new file mode 100644
index 0000000..e717ee7
--- /dev/null
+++ b/bin/tests/data/eta_reduction.nix
@@ -0,0 +1,18 @@
1let
2 double = x: x * 2;
3 inherit (builtins) map;
4 xs = [ 1 2 3 ];
5 f = {
6 inherit double;
7 val = 2;
8 };
9in
10[
11 (map (x: double x) xs)
12
13 # don't lint on non-free exprs
14 (map (f: f.double f.val) [ f ])
15
16 # other non-free forms
17 (map (f: {inherit f;}.double f.val) [ f ])
18]
diff --git a/bin/tests/data/legacy_let_syntax.nix b/bin/tests/data/legacy_let_syntax.nix
new file mode 100644
index 0000000..46e3191
--- /dev/null
+++ b/bin/tests/data/legacy_let_syntax.nix
@@ -0,0 +1,5 @@
1let {
2 body = x + y;
3 x = "hello,";
4 y = " world!";
5}
diff --git a/bin/tests/data/manual_inherit.nix b/bin/tests/data/manual_inherit.nix
new file mode 100644
index 0000000..53ae4d7
--- /dev/null
+++ b/bin/tests/data/manual_inherit.nix
@@ -0,0 +1,12 @@
1let
2 a = 2;
3 y = "y";
4in
5{
6 # trivial
7 a = a;
8
9 # don't lint
10 x.y = y;
11}
12
diff --git a/bin/tests/data/manual_inherit_from.nix b/bin/tests/data/manual_inherit_from.nix
new file mode 100644
index 0000000..214b2a3
--- /dev/null
+++ b/bin/tests/data/manual_inherit_from.nix
@@ -0,0 +1,8 @@
1let
2 a = {b = 2; c = 3;};
3in
4{
5 b = a.b;
6 c = a.c;
7}
8
diff --git a/bin/tests/data/redundant_pattern_bind.nix b/bin/tests/data/redundant_pattern_bind.nix
new file mode 100644
index 0000000..d328c50
--- /dev/null
+++ b/bin/tests/data/redundant_pattern_bind.nix
@@ -0,0 +1 @@
{ ... } @ inputs: null
diff --git a/bin/tests/data/unquoted_splices.nix b/bin/tests/data/unquoted_splices.nix
new file mode 100644
index 0000000..30935b0
--- /dev/null
+++ b/bin/tests/data/unquoted_splices.nix
@@ -0,0 +1,15 @@
1let
2 x = 2;
3 y = 3;
4 a = { "2" = y; };
5in
6[
7 ${x}
8 ${toString (x + y)}
9 a.${toString x}
10
11 # multiline test
12 ${
13 toString x
14 }
15]
diff --git a/bin/tests/data/unquoted_uri.nix b/bin/tests/data/unquoted_uri.nix
new file mode 100644
index 0000000..e56574a
--- /dev/null
+++ b/bin/tests/data/unquoted_uri.nix
@@ -0,0 +1 @@
github:nerdypepper/statix
diff --git a/bin/tests/data/useless_parens.nix b/bin/tests/data/useless_parens.nix
new file mode 100644
index 0000000..cf26441
--- /dev/null
+++ b/bin/tests/data/useless_parens.nix
@@ -0,0 +1,16 @@
1let
2 # parens around primitives
3 a = {
4 b = ("hello");
5 c = (d);
6 e = ({ f = 2; });
7 };
8
9 # parens around let-value
10 g = (1 + 2);
11 h = ({ inherit i; });
12
13 # TODO: binary exprs, function args etc.
14in
15 # parens around let body
16 (null)