nixpkgs/pkgs/build-support/testers/shellcheck/tests.nix
Robert Hensing 3fb14db08a testers.shellcheck: init
Needed for testing upcoming commit.
2024-07-16 20:10:02 +02:00

39 lines
830 B
Nix

# Run:
# nix-build -A tests.testers.shellcheck
{ lib, testers, runCommand }:
let
inherit (lib) fileset;
in
lib.recurseIntoAttrs {
example-dir = runCommand "test-testers-shellcheck-example-dir" {
failure = testers.testBuildFailure
(testers.shellcheck {
src = fileset.toSource {
root = ./.;
fileset = fileset.unions [
./example.sh
];
};
});
} ''
log="$failure/testBuildFailure.log"
echo "Checking $log"
grep SC2068 "$log"
touch $out
'';
example-file = runCommand "test-testers-shellcheck-example-file" {
failure = testers.testBuildFailure
(testers.shellcheck {
src = ./example.sh;
});
} ''
log="$failure/testBuildFailure.log"
echo "Checking $log"
grep SC2068 "$log"
touch $out
'';
}