pkgsrc-Changes archive

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

CVS commit: pkgsrc/regress/infra-unittests



Module Name:    pkgsrc
Committed By:   rillig
Date:           Wed Jul  1 09:10:11 UTC 2020

Modified Files:
        pkgsrc/regress/infra-unittests: show-all.sh

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 pkgsrc/regress/infra-unittests/show-all.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/regress/infra-unittests/show-all.sh
diff -u pkgsrc/regress/infra-unittests/show-all.sh:1.1 pkgsrc/regress/infra-unittests/show-all.sh:1.2
--- pkgsrc/regress/infra-unittests/show-all.sh:1.1      Wed Jul  1 08:15:58 2020
+++ pkgsrc/regress/infra-unittests/show-all.sh  Wed Jul  1 09:10:11 2020
@@ -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 @@ fi
 
 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 @@ EOF
        "$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 @@ EOF
 
        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