Skip to content

Commit 235539b

Browse files
committed
Add tests for path interpolations
1 parent 25c7628 commit 235539b

8 files changed

+47
-0
lines changed

.reuse/dep5

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ Copyright: 2019 Serokell <hi@serokell.io>
55
Copyright: 2019 Lars Jellema <lars.jellema@gmail.com>
66
License: MPL-2.0
77

8+
Files: test/correct/*
9+
Copyright: 2022 Serokell <hi@serokell.io>
10+
Copyright: 2022 Lars Jellema <lars.jellema@gmail.com>
11+
License: MPL-2.0
12+
13+
Files: test/changed/*
14+
Copyright: 2022 Serokell <hi@serokell.io>
15+
Copyright: 2022 Lars Jellema <lars.jellema@gmail.com>
16+
License: MPL-2.0
17+
18+
Files: test/invalid/*
19+
Copyright: 2022 Serokell <hi@serokell.io>
20+
Copyright: 2022 Lars Jellema <lars.jellema@gmail.com>
21+
License: MPL-2.0
22+
823
Files: flake.lock
924
Copyright: 2020 Serokell <hi@serokell.io>
1025
Copyright: 2022 Yorick van Pelt <yorickvanpelt@gmail.com>

test/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- © 2022 Serokell <hi@serokell.io>
2+
- © 2022 Lars Jellema <lars.jellema@gmail.com>
3+
-
4+
- SPDX-License-Identifier: MPL-2.0
5+
-->
6+
7+
Tests in `correct` are formatted the way they should be.
8+
Running `nixfmt --verify` on them should result in the output being the same as
9+
the input.
10+
11+
Tests in `invalid` should return an error when formatted.
12+
13+
Tests in `changed` have input and output files. `nixfmt --verify foo.in.nix`
14+
should output exactly `foo.out.nix`.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
let
2+
foo = "foo";
3+
bar = "bar";
4+
5+
in [
6+
/${foo}
7+
./${foo}
8+
/foo/${bar}
9+
/foo${bar}
10+
/${foo}/bar
11+
/${foo}bar
12+
/foo${bar}baz
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<nixpkgs/${"pkgs"}>

test/invalid/naked-interpolation.nix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
${"foo"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
${"/foo"}/bar
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/foo\${"bar"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo${"bar"}/baz

0 commit comments

Comments
 (0)