5ca88bfbb9
GitOrigin-RevId: 9f918d616c5321ad374ae6cb5ea89c9e04bf3e58
38 lines
830 B
Nix
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
|
|
'';
|
|
}
|