mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-06 05:47:13 +02:00
community/bats: add check()
The patch is from https://github.com/bats-core/bats-core
This commit is contained in:
parent
90f33cc9f7
commit
b8da9232a2
@ -0,0 +1,35 @@
|
|||||||
|
From 1ed87ecb7f0b8f2be4c04aed242f2114975ab8e1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Bland <mbland@acm.org>
|
||||||
|
Date: Mon, 2 Oct 2017 22:02:00 -0400
|
||||||
|
Subject: [PATCH] test/bats: Add fake tput to fix Alpine tests
|
||||||
|
|
||||||
|
The test cases that use the `-p` or `--pretty` flag would fail if `tput`
|
||||||
|
wasn't available (installed as part of the `ncurses` package). On
|
||||||
|
Alpine, `ncurses` isn't installed by default. This change ensures the
|
||||||
|
tests validate the expected behavior regardless of whether `tput` is
|
||||||
|
available.
|
||||||
|
---
|
||||||
|
test/test_helper.bash | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/test/test_helper.bash b/test/test_helper.bash
|
||||||
|
index 302f743..af89003 100644
|
||||||
|
--- a/test/test_helper.bash
|
||||||
|
+++ b/test/test_helper.bash
|
||||||
|
@@ -11,6 +11,13 @@ filter_control_sequences() {
|
||||||
|
"$@" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g'
|
||||||
|
}
|
||||||
|
|
||||||
|
+if ! command -v tput >/dev/null; then
|
||||||
|
+ tput() {
|
||||||
|
+ printf '1000\n'
|
||||||
|
+ }
|
||||||
|
+ export -f tput
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
teardown() {
|
||||||
|
[ -d "$TMP" ] && rm -f "$TMP"/*
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.15.0
|
||||||
|
|
@ -8,22 +8,29 @@ arch="noarch"
|
|||||||
license="MIT"
|
license="MIT"
|
||||||
depends="bash"
|
depends="bash"
|
||||||
subpackages="$pkgname-doc"
|
subpackages="$pkgname-doc"
|
||||||
source="$pkgname-$pkgver.tar.gz::https://github.com/sstephenson/$pkgname/archive/v$pkgver.tar.gz"
|
source="$pkgname-$pkgver.tar.gz::https://github.com/sstephenson/$pkgname/archive/v$pkgver.tar.gz
|
||||||
|
0001-test-bats-Add-fake-tput-to-fix-Alpine-tests.patch"
|
||||||
builddir="$srcdir/$pkgname-$pkgver"
|
builddir="$srcdir/$pkgname-$pkgver"
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$builddir"
|
||||||
|
bash -c 'bin/bats --tap test'
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$builddir"
|
cd "$builddir"
|
||||||
|
|
||||||
mkdir -p "$pkgdir"/usr/lib/bats "$pkgdir"/usr/bin
|
mkdir -p "$pkgdir"/usr/lib/bats "$pkgdir"/usr/bin
|
||||||
|
|
||||||
# Note: We don't use /usr/libexec in Alpine.
|
# Note: We don't use /usr/libexec in Alpine.
|
||||||
cp -r libexec/* "$pkgdir"/usr/lib/bats || return 1
|
cp -r libexec/* "$pkgdir"/usr/lib/bats
|
||||||
ln -s ../lib/bats/bats "$pkgdir"/usr/bin/bats
|
ln -s ../lib/bats/bats "$pkgdir"/usr/bin/bats
|
||||||
|
|
||||||
local i; for i in 1 7; do
|
local i; for i in 1 7; do
|
||||||
install -m 644 -D man/bats.$i \
|
install -m 644 -D man/bats.$i \
|
||||||
"$pkgdir"/usr/share/man/man$i/bats.$i || return 1
|
"$pkgdir"/usr/share/man/man$i/bats.$i
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="83c6c0e3ceec149708a8db5d33e95cc84852d8189498c22131c00f4288a6c870f9d522bae9230157f442338dc101e1468451d78dfa274afb83a6f0dd614c8bdb bats-0.4.0.tar.gz"
|
sha512sums="83c6c0e3ceec149708a8db5d33e95cc84852d8189498c22131c00f4288a6c870f9d522bae9230157f442338dc101e1468451d78dfa274afb83a6f0dd614c8bdb bats-0.4.0.tar.gz
|
||||||
|
f6e6453e0cd783dc6835cd1f1e256bc8fcfad2ba1611bd4901cf586cb227788516ef74cadcad05889b15a23251a2c23f3f07e4676c1d229cb80bec8e8bf49394 0001-test-bats-Add-fake-tput-to-fix-Alpine-tests.patch"
|
||||||
|
Loading…
Reference in New Issue
Block a user