3 shopt -s inherit_errexit
8 echo >&2 "test case failed: " "$@"
12 if test -n "${TEST_LIB:-}"; then
13 NIX_PATH
=nixpkgs
="$(dirname "$TEST_LIB")"
15 NIX_PATH
=nixpkgs
="$(cd "$
(dirname "${BASH_SOURCE[0]}")/..
/..
"; pwd)"
26 touch {README.md
,module.o
,foo.bar
}
28 # nix-instantiate doesn't write out the source, only computing the hash, so
29 # this uses the experimental nix command instead.
31 dir
="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "$
{
34 (cd "$dir"; find) |
sort -f |
diff -U10 - <(cat <<EOF
39 ) || die
"cleanSource 1"
42 dir
="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "$
{
43 cleanSourceWith
{ src
= '"$work"'; filter
= path
: type: ! hasSuffix
".bar" path
; }
45 (cd "$dir"; find) |
sort -f |
diff -U10 - <(cat <<EOF
50 ) || die
"cleanSourceWith 1"
52 dir
="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "$
{
53 cleanSourceWith
{ src
= cleanSource
'"$work"'; filter
= path
: type: ! hasSuffix
".bar" path
; }
55 (cd "$dir"; find) |
sort -f |
diff -U10 - <(cat <<EOF
59 ) || die
"cleanSourceWith + cleanSource"