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:           Thu Mar 19 22:46:34 UTC 2020

Modified Files:
        pkgsrc/regress/infra-unittests: subst.sh

Log Message:
regress/infra-unittests: add more tests for subst.mk failures


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 pkgsrc/regress/infra-unittests/subst.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/subst.sh
diff -u pkgsrc/regress/infra-unittests/subst.sh:1.1 pkgsrc/regress/infra-unittests/subst.sh:1.2
--- pkgsrc/regress/infra-unittests/subst.sh:1.1 Thu Mar 19 16:58:35 2020
+++ pkgsrc/regress/infra-unittests/subst.sh     Thu Mar 19 22:46:34 2020
@@ -297,11 +297,64 @@ EOF
        create_file_lines "exists"      "this file exists"
 
        test_file "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$?
-       assert_that "$exitcode" --equals "0"
+
        create_file_lines "expected-output" \
                '=> Substituting "class" in *exist* *not-found*' \
                'warning: [subst.mk:class] Ignoring non-existent file "./*not-found*".'
-
        assert_that "actual-output" --file-equals "expected-output"
        assert_that "exists" --file-contains-exactly "this example exists"
+       assert_that "$exitcode" --equals "0"
+fi
+
+
+if testcase "multiple missing files, all are reported at once"; then
+
+       create_file "testcase.mk" <<EOF
+SUBST_CLASSES+=                class
+SUBST_STAGE.class=     pre-configure
+SUBST_FILES.class=     does not exist
+SUBST_SED.class=       -e 'sahara'
+
+.include "prepare-subst.mk"
+.include "mk/subst.mk"
+EOF
+
+       test_file "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$?
+
+       create_file_lines "expected-output" \
+               '=> Substituting "class" in does not exist' \
+               'warning: [subst.mk:class] Ignoring non-existent file "./does".' \
+               'warning: [subst.mk:class] Ignoring non-existent file "./not".' \
+               'warning: [subst.mk:class] Ignoring non-existent file "./exist".'
+
+       assert_that "actual-output" --file-equals "expected-output"
+       assert_that "$exitcode" --equals "0"
+fi
+
+
+if testcase "multiple no-op files, all are reported at once"; then
+
+       create_file "testcase.mk" <<EOF
+SUBST_CLASSES+=                class
+SUBST_STAGE.class=     pre-configure
+SUBST_FILES.class=     first second third
+SUBST_SED.class=       -e 's,from,to,'
+
+.include "prepare-subst.mk"
+.include "mk/subst.mk"
+EOF
+       create_file_lines "first"       "text"
+       create_file_lines "second"      "second"
+       create_file_lines "third"       "third"
+
+       test_file "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$?
+
+       create_file_lines "expected-output" \
+               '=> Substituting "class" in first second third' \
+               'info: [subst.mk:class] Nothing changed in ./first.' \
+               'info: [subst.mk:class] Nothing changed in ./second.' \
+               'info: [subst.mk:class] Nothing changed in ./third.'
+
+       assert_that "actual-output" --file-equals "expected-output"
+       assert_that "$exitcode" --equals "0"
 fi



Home | Main Index | Thread Index | Old Index