Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/infra-unittests regress/infra-unittests: add t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d64a8d6da9d2
branches:  trunk
changeset: 435133:d64a8d6da9d2
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Jul 01 09:10:11 2020 +0000

description:
regress/infra-unittests: add test for show-all with custom width

diffstat:

 regress/infra-unittests/show-all.sh |  56 ++++++++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 4 deletions(-)

diffs (82 lines):

diff -r 0e423f6e3dda -r d64a8d6da9d2 regress/infra-unittests/show-all.sh
--- a/regress/infra-unittests/show-all.sh       Wed Jul 01 08:57:27 2020 +0000
+++ b/regress/infra-unittests/show-all.sh       Wed Jul 01 09:10:11 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: show-all.sh,v 1.1 2020/07/01 08:15:58 rillig Exp $
+# $NetBSD: show-all.sh,v 1.2 2020/07/01 09:10:11 rillig Exp $
 #
 # Tests for the show-all target from mk/misc/show.mk.
 #
@@ -117,6 +117,9 @@
 
 if test_case_begin 'show dollars in variable values'; then
 
+       # Up to 2020-03-20, the output of the ENV and ARGS variables differed
+       # a lot from the PLAIN variable.
+
        create_file 'test.mk' <<'EOF'
 SHELLVAR_PLAIN=                "$$var $${var} $$other $$$$"
 SHELLVAR_ENV=          "$$var $${var} $$other $$$$"
@@ -135,9 +138,6 @@
        "$make" -f 'test.mk' 'show-all-shellvar' 1> 'output' 2>&1 \
        && exitcode=0 || exitcode=$?
 
-       # Up to 2020-03-20, the output of the ENV and ARGS variables differed
-       # a lot from the PLAIN variable.
-       #
        create_file 'expected' <<'EOF'
 shellvar:
   pkg   SHELLVAR_PLAIN=         "$$var $${var} $$other $$$$"
@@ -155,3 +155,51 @@
 
        test_case_end
 fi
+
+
+if test_case_begin 'individual width'; then
+
+       # If the variable names of a group are typically longer than 16
+       # characters, it is possible to increase the width.
+
+       create_file 'test.mk' <<'EOF'
+VAR_PLAIN=             value
+VAR_ENV=               value1 value2
+VAR_ARGS=              value1 value2
+
+_VARGROUPS+=           var
+_VARGROUPS_WIDTH.var=  15
+_PKG_VARS.var=         VAR_PLAIN VAR_PLAIN_LONG_NAME
+_PKG_VARS.var+=                VAR_ENV VAR_ENV_LONG_NAME
+_PKG_VARS.var+=                VAR_ARGS VAR_ARGS_LONG_NAME
+_SORTED_VARS.var=      *_ENV
+_LISTED_VARS.var=      *_ARGS
+
+RUN=   @set -eu;
+.include "${PKGSRCDIR}/mk/misc/show.mk"
+EOF
+
+       PKGSRCDIR="$pkgsrcdir" \
+       "$make" -f 'test.mk' 'show-all-var' 1> 'output' 2>&1 \
+       && exitcode=0 || exitcode=$?
+
+       create_file 'expected' <<'EOF'
+var:
+  pkg   VAR_PLAIN=      "$$var $${var} $$other $$$$"
+  pkg   VAR_PLAIN_LONG_NAME # undefined
+  pkg   VAR_ENV=        \
+                        "$$var $${var} $$other $$$$" \
+                        # end of VAR_ENV (sorted)
+  pkg   VAR_ENV_LONG_NAME # undefined
+  pkg   VAR_ARGS=       \
+                        "$$var $${var} $$other $$$$" \
+                        # end of VAR_ARGS
+  pkg   VAR_ARGS_LONG_NAME # undefined
+
+EOF
+
+       assert_that "$exitcode" --equals '0'
+       assert_that 'output' --file-equals 'expected'
+
+       test_case_end
+fi



Home | Main Index | Thread Index | Old Index