Skip to content

Commit

Permalink
feat: add tests for commands examples
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Jan 7, 2024
1 parent 6e07442 commit 52b0eed
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/extra/commands.examples.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ pkgs, devshell, runTest }:
{
nested =
let
shell = devshell.mkShell {
devshell.name = "nested-commands-test";
commands = (import ../../nix/commands/examples.nix { inherit pkgs; }).nested;
};
in
runTest "nested" { } ''
# Load the devshell
source ${shell}/env.bash
type -p python3
# Has hyperfine
# Has no yq
if [[ -z "$(type -p hyperfine)" ]]; then
echo "OK"
else
echo "Error! Has hyperfine"
fi
# Has no yq
if [[ -z "$(type -p yq)" ]]; then
echo "OK"
else
echo "Error! Has yq"
fi
'';

flat =
let
shell = devshell.mkShell {
devshell.name = "flat-commands-test";
commands = (import ../../nix/commands/examples.nix { inherit pkgs; }).flat;
};
in
runTest "flat" { } ''
# Load the devshell
source ${shell}/env.bash
# Has yarn
type -p yarn
# Has hello
type -p hello
# Has black
type -p black
'';
}

0 comments on commit 52b0eed

Please sign in to comment.