Skip to content

Commit a832967

Browse files
committed
refactor: interpolation test
- fix test failing on macos due to directory name wrapping
1 parent 22b7917 commit a832967

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/extra/devshell.menu.interpolate.nix

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
33
interpolate =
44
let
55
shell = devshell.mkShell {
6-
devshell.menu.interpolate = true;
7-
commands = [
6+
devshell.menu = {
7+
interpolate = true;
8+
width = 200;
9+
};
10+
commands.scripts = [
811
{ prefix = "hello"; help = ''hello from "$PRJ_ROOT"!''; }
912
{ prefix = "hola"; help = ''hola from '\$PRJ_ROOT'!''; }
13+
{ prefix = "hallo"; help = ''hallo from "$PRJ_ROOT"!''; interpolate = false; }
1014
];
1115
};
1216
in
1317
runTest "interpolate" { } ''
1418
# Check interpolation is enabled
15-
eval ${shell}/bin/menu | grep "hello from \"$PRJ_ROOT\"!"
19+
( eval ${shell}/bin/menu | grep "hello from \"$PRJ_ROOT\"!" )
1620
1721
# Check escaped variable
18-
eval ${shell}/bin/menu | grep 'hola from '\'''$PRJ_ROOT'\'
22+
( eval ${shell}/bin/menu | grep 'hola from '\'''$PRJ_ROOT'\' )
23+
24+
# Check non-interpolated variable
25+
( eval ${shell}/bin/menu | grep 'hallo from "$PRJ_ROOT"!' )
1926
'';
2027
}

0 commit comments

Comments
 (0)