diff options
author | Akshay <[email protected]> | 2021-11-03 09:18:35 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-11-08 05:03:13 +0000 |
commit | 4e063b2abc402ac4d6902647e821978269025c7d (patch) | |
tree | a8935a5432fe86d0e5facb9ff8acc71edcb7f782 /bin/tests/data | |
parent | 78decf580d22fa792c19c40ace39762fb027067c (diff) |
add snapshot test suitesnapshot-tests
Diffstat (limited to 'bin/tests/data')
-rw-r--r-- | bin/tests/data/bool_comparison.nix | 13 | ||||
-rw-r--r-- | bin/tests/data/collapsible_let_in.nix | 9 | ||||
-rw-r--r-- | bin/tests/data/deprecated_is_null.nix | 6 | ||||
-rw-r--r-- | bin/tests/data/empty_let_in.nix | 3 | ||||
-rw-r--r-- | bin/tests/data/empty_pattern.nix | 9 | ||||
-rw-r--r-- | bin/tests/data/eta_reduction.nix | 18 | ||||
-rw-r--r-- | bin/tests/data/legacy_let_syntax.nix | 5 | ||||
-rw-r--r-- | bin/tests/data/manual_inherit.nix | 12 | ||||
-rw-r--r-- | bin/tests/data/manual_inherit_from.nix | 8 | ||||
-rw-r--r-- | bin/tests/data/redundant_pattern_bind.nix | 1 | ||||
-rw-r--r-- | bin/tests/data/unquoted_splices.nix | 15 | ||||
-rw-r--r-- | bin/tests/data/unquoted_uri.nix | 1 | ||||
-rw-r--r-- | bin/tests/data/useless_parens.nix | 16 |
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 @@ | |||
1 | let | ||
2 | a = 2; | ||
3 | b = 3; | ||
4 | in | ||
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 @@ | |||
1 | let | ||
2 | e = null; | ||
3 | in | ||
4 | if isNull e | ||
5 | then "no" | ||
6 | else "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 @@ | |||
1 | let | ||
2 | in | ||
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 @@ | |||
1 | let | ||
2 | double = x: x * 2; | ||
3 | inherit (builtins) map; | ||
4 | xs = [ 1 2 3 ]; | ||
5 | f = { | ||
6 | inherit double; | ||
7 | val = 2; | ||
8 | }; | ||
9 | in | ||
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 @@ | |||
1 | let { | ||
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 @@ | |||
1 | let | ||
2 | a = 2; | ||
3 | y = "y"; | ||
4 | in | ||
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 @@ | |||
1 | let | ||
2 | a = {b = 2; c = 3;}; | ||
3 | in | ||
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 @@ | |||
1 | let | ||
2 | x = 2; | ||
3 | y = 3; | ||
4 | a = { "2" = y; }; | ||
5 | in | ||
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 @@ | |||
1 | let | ||
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. | ||
14 | in | ||
15 | # parens around let body | ||
16 | (null) | ||