From 52b0eed44c46125965b00d1d435334816093e2f1 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sat, 6 Jan 2024 20:32:40 +0300 Subject: [PATCH] feat: add tests for commands examples --- tests/extra/commands.examples.nix | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/extra/commands.examples.nix diff --git a/tests/extra/commands.examples.nix b/tests/extra/commands.examples.nix new file mode 100644 index 00000000..e6c790a9 --- /dev/null +++ b/tests/extra/commands.examples.nix @@ -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 + ''; +}