nixpkgs/pkgs/by-name/au/autoprefixer/tests/simple-execution.nix
Sergei Trofimovich 93d84f953f autoprefixer.tests: fix the eval
Without the change thee val fails as:

    $ nix build --no-link -f. autoprefixer.tests
    ...
       error: attribute 'packageName' missing
       at pkgs/by-name/au/autoprefixer/tests/simple-execution.nix:4:26:
            3| let
            4|   inherit (autoprefixer) packageName version;
             |                          ^
            5| in
2024-07-22 22:28:14 +01:00

26 lines
805 B
Nix

{ runCommand, autoprefixer }:
let
inherit (autoprefixer) pname version;
in
runCommand "${pname}-tests" { meta.timeout = 60; }
''
# get version of installed program and compare with package version
claimed_version="$(${autoprefixer}/bin/autoprefixer --version | awk '{print $2}')"
if [[ "$claimed_version" != "${version}" ]]; then
echo "Error: program version does not match package version ($claimed_version != ${version})"
exit 1
fi
# run dummy commands
${autoprefixer}/bin/autoprefixer --help > /dev/null
${autoprefixer}/bin/autoprefixer --info > /dev/null
# Testing the actual functionality is done in the test for postcss
# because autoprefixer is a postcss plugin
# needed for Nix to register the command as successful
touch $out
''