depot/third_party/nixpkgs/pkgs/build-support/testers/shellcheck/tests.nix
Default email 5ca88bfbb9 Project import generated by Copybara.
GitOrigin-RevId: 9f918d616c5321ad374ae6cb5ea89c9e04bf3e58
2024-07-31 10:19:44 +00:00

38 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
'';
}