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 Apr 23 18:30:37 UTC 2020
Modified Files:
pkgsrc/regress/infra-unittests: subst.sh
Log Message:
regress/infra-unittests: add more tests for subst.mk
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 pkgsrc/regress/infra-unittests/subst.sh:1.20
--- pkgsrc/regress/infra-unittests/subst.sh:1.19 Sat Apr 18 15:04:34 2020
+++ pkgsrc/regress/infra-unittests/subst.sh Thu Apr 23 18:30:37 2020
@@ -971,3 +971,97 @@ if test_case_begin "first filename patte
test_case_end
fi
+
+
+if test_case_begin "empty SUBST_FILES"; then
+
+ # An empty SUBST_FILES section is ok.
+ # It may have been produced by a shell command like find(1).
+
+ create_file_lines "testcase.mk" \
+ 'SUBST_CLASSES+= id' \
+ 'SUBST_STAGE.id= pre-configure' \
+ 'SUBST_FILES.id= # none' \
+ 'SUBST_SED.id= -e s,from,to,' \
+ 'SUBST_NOOP_OK.id= no' \
+ '' \
+ 'all:' \
+ ' @printf "%s\n" ${PKG_FAIL_REASON:Uok}' \
+ '' \
+ '.include "prepare-subst.mk"' \
+ '.include "mk/subst.mk"'
+
+ run_bmake "testcase.mk" "pre-configure" "all" 1> "$tmpdir/out" 2>&1 \
+ && exitcode=0 || exitcode=$?
+
+ assert_that "out" --file-is-lines \
+ '=> Substituting "id" in ' \
+ 'ok'
+
+ test_case_end
+fi
+
+
+if test_case_begin "empty SUBST_SED"; then
+
+ create_file_lines "testcase.mk" \
+ 'SUBST_CLASSES+= id' \
+ 'SUBST_STAGE.id= pre-configure' \
+ 'SUBST_FILES.id= file' \
+ 'SUBST_SED.id= # none' \
+ 'SUBST_NOOP_OK.id= no' \
+ '' \
+ 'all:' \
+ ' @printf "%s\n" ${PKG_FAIL_REASON:Uok}' \
+ '' \
+ '.include "prepare-subst.mk"' \
+ '.include "mk/subst.mk"'
+
+ run_bmake "testcase.mk" "pre-configure" "all" 1> "$tmpdir/out" 2>&1 \
+ && exitcode=0 || exitcode=$?
+
+ assert_that "out" --file-is-lines \
+ '=> Substituting "id" in file' \
+ 'warning: [subst.mk:id] Ignoring non-existent file "./file".' \
+ 'fail: [subst.mk:id] The filename pattern "file" has no effect.' \
+ '*** Error code 1' \
+ '' \
+ 'Stop.' \
+ "$make: stopped in $PWD"
+
+ test_case_end
+fi
+
+
+if test_case_begin "typo in SUBST_CLASSES"; then
+
+ # Look closely. The SUBST_CLASSES line contains a typo.
+ # subst.mk does not catch this, but pkglint does.
+
+ create_file_lines "testcase.mk" \
+ 'SUBST_CLASSES=+ id' \
+ 'SUBST_STAGE.id= pre-configure' \
+ 'SUBST_FILES.id= file' \
+ 'SUBST_SED.id= # none' \
+ 'SUBST_NOOP_OK.id= no' \
+ '' \
+ 'all:' \
+ ' @printf "%s\n" ${PKG_FAIL_REASON:Uok}' \
+ '' \
+ '.include "prepare-subst.mk"' \
+ '.include "mk/subst.mk"'
+
+ run_bmake "testcase.mk" "pre-configure" "all" 1> "$tmpdir/out" 2>&1 \
+ && exitcode=0 || exitcode=$?
+
+ assert_that "out" --file-is-lines \
+ '=> Substituting "id" in file' \
+ 'warning: [subst.mk:id] Ignoring non-existent file "./file".' \
+ 'fail: [subst.mk:id] The filename pattern "file" has no effect.' \
+ '*** Error code 1' \
+ '' \
+ 'Stop.' \
+ "$make: stopped in $PWD"
+
+ test_case_end
+fi
Home |
Main Index |
Thread Index |
Old Index