aboutsummaryrefslogtreecommitdiff
path: root/bin/tests
diff options
context:
space:
mode:
authorAkshay <nerdy@peppe.rs>2021-11-03 09:18:35 +0000
committerAkshay <nerdy@peppe.rs>2021-11-08 05:03:13 +0000
commit4e063b2abc402ac4d6902647e821978269025c7d (patch)
treea8935a5432fe86d0e5facb9ff8acc71edcb7f782 /bin/tests
parent78decf580d22fa792c19c40ace39762fb027067c (diff)
add snapshot test suitesnapshot-tests
Diffstat (limited to 'bin/tests')
-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
-rw-r--r--bin/tests/main.rs47
-rw-r--r--bin/tests/snapshots/main__bool_comparison.snap62
-rw-r--r--bin/tests/snapshots/main__collapsible_let_in.snap17
-rw-r--r--bin/tests/snapshots/main__deprecated_is_null.snap13
-rw-r--r--bin/tests/snapshots/main__empty_let_in.snap14
-rw-r--r--bin/tests/snapshots/main__empty_pattern.snap20
-rw-r--r--bin/tests/snapshots/main__eta_reduction.snap13
-rw-r--r--bin/tests/snapshots/main__legacy_let_syntax.snap14
-rw-r--r--bin/tests/snapshots/main__manual_inherit.snap13
-rw-r--r--bin/tests/snapshots/main__manual_inherit_from.snap20
-rw-r--r--bin/tests/snapshots/main__redundant_pattern_bind.snap13
-rw-r--r--bin/tests/snapshots/main__unquoted_splices.snap35
-rw-r--r--bin/tests/snapshots/main__unquoted_uri.snap13
-rw-r--r--bin/tests/snapshots/main__useless_parens.snap48
27 files changed, 458 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)
diff --git a/bin/tests/main.rs b/bin/tests/main.rs
new file mode 100644
index 0000000..6175c90
--- /dev/null
+++ b/bin/tests/main.rs
@@ -0,0 +1,47 @@
1mod util {
2 #[macro_export]
3 macro_rules! test_lint {
4 ($($tname:ident),*,) => {
5 test_lint!($($tname),*);
6 };
7 ($($tname:ident),*) => {
8 $(
9 #[test]
10 fn $tname() {
11 use statix::{config::OutFormat, traits::WriteDiagnostic, lint};
12 use vfs::ReadOnlyVfs;
13
14 let file_path = concat!("data/", stringify!($tname), ".nix");
15 let contents = include_str!(concat!("data/", stringify!($tname), ".nix"));
16
17 let vfs = ReadOnlyVfs::singleton(file_path, contents.as_bytes());
18
19 let mut buffer = Vec::new();
20 vfs.iter().map(lint::lint).for_each(|r| {
21 buffer.write(&r, &vfs, OutFormat::StdErr).unwrap();
22 });
23
24 let stripped = strip_ansi_escapes::strip(&buffer).unwrap();
25 let out = std::str::from_utf8(&stripped).unwrap();
26 insta::assert_snapshot!(&out);
27 }
28 )*
29 };
30 }
31}
32
33test_lint! {
34 bool_comparison,
35 empty_let_in,
36 manual_inherit,
37 manual_inherit_from,
38 legacy_let_syntax,
39 collapsible_let_in,
40 eta_reduction,
41 useless_parens,
42 unquoted_splices,
43 empty_pattern,
44 redundant_pattern_bind,
45 unquoted_uri,
46 deprecated_is_null,
47}
diff --git a/bin/tests/snapshots/main__bool_comparison.snap b/bin/tests/snapshots/main__bool_comparison.snap
new file mode 100644
index 0000000..0865332
--- /dev/null
+++ b/bin/tests/snapshots/main__bool_comparison.snap
@@ -0,0 +1,62 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W01] Warning: Unnecessary comparison with boolean
7 โ•ญโ”€[data/bool_comparison.nix:3:4]
8 โ”‚
9 3 โ”‚ (a == true)
10 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing a with boolean literal true
12โ”€โ”€โ”€โ•ฏ
13[W01] Warning: Unnecessary comparison with boolean
14 โ•ญโ”€[data/bool_comparison.nix:4:4]
15 โ”‚
16 4 โ”‚ (b == true)
17 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
18 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing b with boolean literal true
19โ”€โ”€โ”€โ•ฏ
20[W01] Warning: Unnecessary comparison with boolean
21 โ•ญโ”€[data/bool_comparison.nix:5:4]
22 โ”‚
23 5 โ”‚ (true == c)
24 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
25 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing c with boolean literal true
26โ”€โ”€โ”€โ•ฏ
27[W01] Warning: Unnecessary comparison with boolean
28 โ•ญโ”€[data/bool_comparison.nix:6:4]
29 โ”‚
30 6 โ”‚ (true == d)
31 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
32 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing d with boolean literal true
33โ”€โ”€โ”€โ•ฏ
34[W01] Warning: Unnecessary comparison with boolean
35 โ•ญโ”€[data/bool_comparison.nix:9:4]
36 โ”‚
37 9 โ”‚ (e != true)
38 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
39 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing e with boolean literal true
40โ”€โ”€โ”€โ•ฏ
41[W01] Warning: Unnecessary comparison with boolean
42 โ•ญโ”€[data/bool_comparison.nix:10:4]
43 โ”‚
44 10 โ”‚ (f != false)
45 ยท โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
46 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing f with boolean literal false
47โ”€โ”€โ”€โ”€โ•ฏ
48[W01] Warning: Unnecessary comparison with boolean
49 โ•ญโ”€[data/bool_comparison.nix:11:4]
50 โ”‚
51 11 โ”‚ (true != g)
52 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
53 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing g with boolean literal true
54โ”€โ”€โ”€โ”€โ•ฏ
55[W01] Warning: Unnecessary comparison with boolean
56 โ•ญโ”€[data/bool_comparison.nix:12:4]
57 โ”‚
58 12 โ”‚ (false != h)
59 ยท โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
60 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Comparing h with boolean literal false
61โ”€โ”€โ”€โ”€โ•ฏ
62
diff --git a/bin/tests/snapshots/main__collapsible_let_in.snap b/bin/tests/snapshots/main__collapsible_let_in.snap
new file mode 100644
index 0000000..b135abc
--- /dev/null
+++ b/bin/tests/snapshots/main__collapsible_let_in.snap
@@ -0,0 +1,17 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W06] Warning: These let-in expressions are collapsible
7 โ•ญโ”€[data/collapsible_let_in.nix:1:1]
8 โ”‚
9 1 โ”‚ โ•ญโ”€โ”€โ”€โ–ถ let
10 5 โ”‚ โ”‚ โ•ญโ”€โ–ถ let
11 9 โ”‚ โ”‚ โ”œโ”€โ–ถ a + b + c + d
12 ยท โ”‚ โ”‚ โ”‚
13 ยท โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ This let in expression is nested
14 ยท โ”‚ โ”‚
15 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€ This let in expression contains a nested let in expression
16โ”€โ”€โ”€โ•ฏ
17
diff --git a/bin/tests/snapshots/main__deprecated_is_null.snap b/bin/tests/snapshots/main__deprecated_is_null.snap
new file mode 100644
index 0000000..d49b381
--- /dev/null
+++ b/bin/tests/snapshots/main__deprecated_is_null.snap
@@ -0,0 +1,13 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W13] Warning: Found usage of deprecated builtin isNull
7 โ•ญโ”€[data/deprecated_is_null.nix:4:4]
8 โ”‚
9 4 โ”‚ if isNull e
10 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€ isNull is deprecated, check equality with null instead
12โ”€โ”€โ”€โ•ฏ
13
diff --git a/bin/tests/snapshots/main__empty_let_in.snap b/bin/tests/snapshots/main__empty_let_in.snap
new file mode 100644
index 0000000..426692f
--- /dev/null
+++ b/bin/tests/snapshots/main__empty_let_in.snap
@@ -0,0 +1,14 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W02] Warning: Useless let-in expression
7 โ•ญโ”€[data/empty_let_in.nix:1:1]
8 โ”‚
9 1 โ”‚ โ•ญโ”€โ–ถ let
10 3 โ”‚ โ”œโ”€โ–ถ null
11 ยท โ”‚
12 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ This let-in expression has no entries
13โ”€โ”€โ”€โ•ฏ
14
diff --git a/bin/tests/snapshots/main__empty_pattern.snap b/bin/tests/snapshots/main__empty_pattern.snap
new file mode 100644
index 0000000..3ea7ae0
--- /dev/null
+++ b/bin/tests/snapshots/main__empty_pattern.snap
@@ -0,0 +1,20 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W10] Warning: Found empty pattern in function argument
7 โ•ญโ”€[data/empty_pattern.nix:3:4]
8 โ”‚
9 3 โ”‚ ({ ... }: 42)
10 ยท โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€ This pattern is empty, use _ instead
12โ”€โ”€โ”€โ•ฏ
13[W11] Warning: Found redundant pattern bind in function argument
14 โ•ญโ”€[data/empty_pattern.nix:7:4]
15 โ”‚
16 7 โ”‚ ({ ... } @ inputs: inputs)
17 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€
18 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ This pattern bind is redundant, use inputs instead
19โ”€โ”€โ”€โ•ฏ
20
diff --git a/bin/tests/snapshots/main__eta_reduction.snap b/bin/tests/snapshots/main__eta_reduction.snap
new file mode 100644
index 0000000..6271980
--- /dev/null
+++ b/bin/tests/snapshots/main__eta_reduction.snap
@@ -0,0 +1,13 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W07] Warning: This function expression is eta reducible
7 โ•ญโ”€[data/eta_reduction.nix:11:9]
8 โ”‚
9 11 โ”‚ (map (x: double x) xs)
10 ยท โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€ Found eta-reduction: double
12โ”€โ”€โ”€โ”€โ•ฏ
13
diff --git a/bin/tests/snapshots/main__legacy_let_syntax.snap b/bin/tests/snapshots/main__legacy_let_syntax.snap
new file mode 100644
index 0000000..35aa7ee
--- /dev/null
+++ b/bin/tests/snapshots/main__legacy_let_syntax.snap
@@ -0,0 +1,14 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W05] Warning: Using undocumented `let` syntax
7 โ•ญโ”€[data/legacy_let_syntax.nix:1:1]
8 โ”‚
9 1 โ”‚ โ•ญโ”€โ–ถ let {
10 5 โ”‚ โ”œโ”€โ–ถ }
11 ยท โ”‚
12 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€ Prefer rec over undocumented let syntax
13โ”€โ”€โ”€โ•ฏ
14
diff --git a/bin/tests/snapshots/main__manual_inherit.snap b/bin/tests/snapshots/main__manual_inherit.snap
new file mode 100644
index 0000000..063867c
--- /dev/null
+++ b/bin/tests/snapshots/main__manual_inherit.snap
@@ -0,0 +1,13 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W03] Warning: Assignment instead of inherit
7 โ•ญโ”€[data/manual_inherit.nix:7:3]
8 โ”‚
9 7 โ”‚ a = a;
10 ยท โ”€โ”€โ”€โ”ฌโ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€ This assignment is better written with inherit
12โ”€โ”€โ”€โ•ฏ
13
diff --git a/bin/tests/snapshots/main__manual_inherit_from.snap b/bin/tests/snapshots/main__manual_inherit_from.snap
new file mode 100644
index 0000000..9cf1f5d
--- /dev/null
+++ b/bin/tests/snapshots/main__manual_inherit_from.snap
@@ -0,0 +1,20 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W04] Warning: Assignment instead of inherit from
7 โ•ญโ”€[data/manual_inherit_from.nix:5:3]
8 โ”‚
9 5 โ”‚ b = a.b;
10 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€ This assignment is better written with inherit
12โ”€โ”€โ”€โ•ฏ
13[W04] Warning: Assignment instead of inherit from
14 โ•ญโ”€[data/manual_inherit_from.nix:6:3]
15 โ”‚
16 6 โ”‚ c = a.c;
17 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
18 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€ This assignment is better written with inherit
19โ”€โ”€โ”€โ•ฏ
20
diff --git a/bin/tests/snapshots/main__redundant_pattern_bind.snap b/bin/tests/snapshots/main__redundant_pattern_bind.snap
new file mode 100644
index 0000000..2f26818
--- /dev/null
+++ b/bin/tests/snapshots/main__redundant_pattern_bind.snap
@@ -0,0 +1,13 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W11] Warning: Found redundant pattern bind in function argument
7 โ•ญโ”€[data/redundant_pattern_bind.nix:1:1]
8 โ”‚
9 1 โ”‚ { ... } @ inputs: null
10 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ This pattern bind is redundant, use inputs instead
12โ”€โ”€โ”€โ•ฏ
13
diff --git a/bin/tests/snapshots/main__unquoted_splices.snap b/bin/tests/snapshots/main__unquoted_splices.snap
new file mode 100644
index 0000000..5fd1917
--- /dev/null
+++ b/bin/tests/snapshots/main__unquoted_splices.snap
@@ -0,0 +1,35 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W09] Warning: Found unquoted splice expression
7 โ•ญโ”€[data/unquoted_splices.nix:7:3]
8 โ”‚
9 7 โ”‚ ${x}
10 ยท โ”€โ”€โ”ฌโ”€
11 ยท โ•ฐโ”€โ”€โ”€ Consider quoting this splice expression
12โ”€โ”€โ”€โ•ฏ
13[W09] Warning: Found unquoted splice expression
14 โ•ญโ”€[data/unquoted_splices.nix:8:3]
15 โ”‚
16 8 โ”‚ ${toString (x + y)}
17 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
18 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Consider quoting this splice expression
19โ”€โ”€โ”€โ•ฏ
20[W09] Warning: Found unquoted splice expression
21 โ•ญโ”€[data/unquoted_splices.nix:9:5]
22 โ”‚
23 9 โ”‚ a.${toString x}
24 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€
25 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Consider quoting this splice expression
26โ”€โ”€โ”€โ•ฏ
27[W09] Warning: Found unquoted splice expression
28 โ•ญโ”€[data/unquoted_splices.nix:12:3]
29 โ”‚
30 12 โ”‚ โ•ญโ”€โ–ถ ${
31 14 โ”‚ โ”œโ”€โ–ถ }
32 ยท โ”‚
33 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Consider quoting this splice expression
34โ”€โ”€โ”€โ”€โ•ฏ
35
diff --git a/bin/tests/snapshots/main__unquoted_uri.snap b/bin/tests/snapshots/main__unquoted_uri.snap
new file mode 100644
index 0000000..2f0e5a9
--- /dev/null
+++ b/bin/tests/snapshots/main__unquoted_uri.snap
@@ -0,0 +1,13 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W12] Warning: Found unquoted URI expression
7 โ•ญโ”€[data/unquoted_uri.nix:1:1]
8 โ”‚
9 1 โ”‚ github:nerdypepper/statix
10 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Consider quoting this URI expression
12โ”€โ”€โ”€โ•ฏ
13
diff --git a/bin/tests/snapshots/main__useless_parens.snap b/bin/tests/snapshots/main__useless_parens.snap
new file mode 100644
index 0000000..d44176e
--- /dev/null
+++ b/bin/tests/snapshots/main__useless_parens.snap
@@ -0,0 +1,48 @@
1---
2source: bin/tests/main.rs
3expression: "&out"
4
5---
6[W08] Warning: These parentheses can be omitted
7 โ•ญโ”€[data/useless_parens.nix:16:3]
8 โ”‚
9 16 โ”‚ (null)
10 ยท โ”€โ”€โ”€โ”ฌโ”€โ”€
11 ยท โ•ฐโ”€โ”€โ”€โ”€ Useless parentheses around body of let expression
12โ”€โ”€โ”€โ”€โ•ฏ
13[W08] Warning: These parentheses can be omitted
14 โ•ญโ”€[data/useless_parens.nix:4:9]
15 โ”‚
16 4 โ”‚ b = ("hello");
17 ยท โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€
18 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€ Useless parentheses around value in binding
19โ”€โ”€โ”€โ•ฏ
20[W08] Warning: These parentheses can be omitted
21 โ•ญโ”€[data/useless_parens.nix:5:9]
22 โ”‚
23 5 โ”‚ c = (d);
24 ยท โ”€โ”ฌโ”€
25 ยท โ•ฐโ”€โ”€โ”€ Useless parentheses around value in binding
26โ”€โ”€โ”€โ•ฏ
27[W08] Warning: These parentheses can be omitted
28 โ•ญโ”€[data/useless_parens.nix:6:9]
29 โ”‚
30 6 โ”‚ e = ({ f = 2; });
31 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€
32 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€ Useless parentheses around value in binding
33โ”€โ”€โ”€โ•ฏ
34[W08] Warning: These parentheses can be omitted
35 โ•ญโ”€[data/useless_parens.nix:10:7]
36 โ”‚
37 10 โ”‚ g = (1 + 2);
38 ยท โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€
39 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€ Useless parentheses around value in binding
40โ”€โ”€โ”€โ”€โ•ฏ
41[W08] Warning: These parentheses can be omitted
42 โ•ญโ”€[data/useless_parens.nix:11:7]
43 โ”‚
44 11 โ”‚ h = ({ inherit i; });
45 ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€
46 ยท โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Useless parentheses around value in binding
47โ”€โ”€โ”€โ”€โ•ฏ
48