devshell/tests/devshell_test.nix

55 lines
1.3 KiB
Nix

{
pkgs,
ntlib,
devshell,
...
}: {
suites."Devshell Tests" = {
pos = __curPos;
tests = [
{
name = "basic";
type = "script";
script = let
shell = devshell.mkShell {};
in
# sh
''
${ntlib.helpers.path [pkgs.gnugrep]}
${ntlib.helpers.scriptHelpers}
assert_file_contains ${shell}/env.bash "XDG_DATA_DIRS" "should contain XDG_DATA_DIRS"
'';
}
{
name = "packages";
type = "script";
script = let
shell = devshell.mkShell {
packages = [pkgs.hello];
};
in
# sh
''
${ntlib.helpers.scriptHelpers}
assert "-f ${shell}/bin/hello" "/bin/hello should exist"
'';
}
{
name = "env";
type = "script";
script = let
shell = devshell.mkShell {
env."HELLO".value = "world";
};
in
# sh
''
${ntlib.helpers.path [pkgs.gnugrep]}
${ntlib.helpers.scriptHelpers}
assert_file_contains ${shell}/env.bash "HELLO" "should contain HELLO"
assert_file_contains ${shell}/env.bash "world" "should contain world"
'';
}
];
};
}