# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Contributor: Max Rees <maxcrees@me.com>
# Contributor: William Desportes <williamdes@wdes.fr>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=shunit2
pkgver=2.1.8
pkgrel=1
pkgdesc="A xUnit based unit test framework for Bourne based shell scripts."
url="https://github.com/kward/shunit2/"
arch="noarch"
license="Apache-2.0"
makedepends="bash dash loksh zsh"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/kward/shunit2/archive/v$pkgver.tar.gz
		dash-negative-lineno.patch"

check() {
	_tmpdir="$(mktemp -d -p "${TMPDIR:-/tmp/}" shunit2.XXXXXXXX)"
	# To understand this comment please refer to: https://github.com/kward/shunit2/issues/121
	env -i TMPDIR="$_tmpdir" SHELL="/bin/bash" TERM=xterm ./test_runner
	rm -rf "$_tmpdir"
}

package() {
	install -D -m 755 -t "$pkgdir/usr/bin/" \
		"shunit2"
	install -D -m 644 -t "$pkgdir/usr/share/doc/$pkgname/" \
		"README.md"
}

sha512sums="15aaf28996c9fb5ee5419f63b50013a194a7416dea04eb34eae2481f05e0580bd2c6977ad002b421e2785e2024978fda869cad1ef4125857c2a5ea21bf44a06e  shunit2-2.1.8.tar.gz
b289f4fe3da1f269558aa22c844f374c3dd2bd4d90b9d12422b7b5e90f28950ba55e5ec092c2c2532398c25c3b7d37465802dd281c9543bb0f1f56c0957fb5aa  dash-negative-lineno.patch"
