Thread (25 messages) 25 messages, 8 authors, 2021-08-04

Re: [PATCH v2 2/3] test-lib-functions.sh: add a test_with_columns function

flat view

From: SZEDER Gábor <hidden>
Date: 2021-08-02 17:14:35

On Mon, Aug 02, 2021 at 03:46:27PM +0200, Ævar Arnfjörð Bjarmason wrote:
Add a helper function to wrap patterns of "COLUMNS=N <command>" as
"test_with_columns N <command>". This will be used and extended in the
next commit.
quoted hunk ↗ jump to hunk
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 37da7d9a99a..536339faaa2 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1718,3 +1718,11 @@ test_region () {
 test_readlink () {
 	perl -le 'print readlink($_) for @ARGV' "$@"
 }
+
+# Test a with a given number of COLUMNS in the environment.
+test_with_columns () {
+	local columns=$1
+	shift
+
+	COLUMNS=$columns "$@"
+}
This function needs some redirections to separate the tested command's
standard error from the function's '-x' trace, see a5bf824f3b (t:
prevent '-x' tracing from interfering with test helpers' stderr,
2018-02-25).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help