about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/trivial-builders/test/write-shell-script.nix
blob: a5c9f1fae42f6f15c71b1497366f7c683f7212db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ lib, writeShellScript }: let
  output = "hello";
in (writeShellScript "test-script" ''
  echo ${lib.escapeShellArg output}
'').overrideAttrs (old: {
  checkPhase = old.checkPhase or "" + ''
    expected=${lib.escapeShellArg output}
    got=$("$target")
    if [[ "$got" != "$expected" ]]; then
      echo "wrong output: expected $expected, got $got"
      exit 1
    fi
  '';
})