Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 44 lines 1.3 kB view raw
1{ runCommand, postcss-cli }: 2 3let 4 inherit (postcss-cli) packageName version; 5in 6 7runCommand "${packageName}-tests" { meta.timeout = 60; } '' 8 # get version of installed program and compare with package version 9 claimed_version="$(${postcss-cli}/bin/postcss --version)" 10 if [[ "$claimed_version" != "${version}" ]]; then 11 echo "Error: program version does not match package version ($claimed_version != ${version})" 12 exit 1 13 fi 14 15 # run basic help command 16 ${postcss-cli}/bin/postcss --help > /dev/null 17 18 # basic autoprefixer test 19 config_dir="$(mktemp -d)" 20 clean_up() { 21 rm -rf "$config_dir" 22 } 23 trap clean_up EXIT 24 echo " 25 module.exports = { 26 plugins: { 27 'autoprefixer': { overrideBrowserslist: 'chrome 40' }, 28 }, 29 } 30 " > "$config_dir/postcss.config.js" 31 input='a{ user-select: none; }' 32 expected_output='a{ -webkit-user-select: none; user-select: none; }' 33 actual_output="$(echo $input | ${postcss-cli}/bin/postcss --no-map --config $config_dir)" 34 if [[ "$actual_output" != "$expected_output" ]]; then 35 echo "Error: autoprefixer did not output the correct CSS:" 36 echo "$actual_output" 37 echo "!=" 38 echo "$expected_output" 39 exit 1 40 fi 41 42 # needed for Nix to register the command as successful 43 touch $out 44''