diff options
author | rillig <rillig@pkgsrc.org> | 2020-03-28 12:08:28 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-03-28 12:08:28 +0000 |
commit | a727913246305fc93cb3fc3aa9f8abd8b6a98584 (patch) | |
tree | 2f25a38e0c39fc089884ed68db31ff81dbaa05d0 /regress | |
parent | 87c22494cc6c374ead70c7cf6c20a676a092fb10 (diff) | |
download | pkgsrc-a727913246305fc93cb3fc3aa9f8abd8b6a98584.tar.gz |
regress/infra-unittests: add test for SUBST_FILES without effect
Diffstat (limited to 'regress')
-rw-r--r-- | regress/infra-unittests/subst.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/regress/infra-unittests/subst.sh b/regress/infra-unittests/subst.sh index 30c6c060721..aae897ded88 100644 --- a/regress/infra-unittests/subst.sh +++ b/regress/infra-unittests/subst.sh @@ -923,3 +923,38 @@ if test_case_begin "pattern matches only directory"; then test_case_end fi + + +if test_case_begin "first filename pattern has no effect"; then + + # All patterns of SUBST_FILES should be applied before erroring out. + # TODO: also warn about file2 + + create_file_lines "testcase.mk" \ + 'SUBST_CLASSES+= id' \ + 'SUBST_STAGE.id= pre-configure' \ + 'SUBST_FILES.id= file1 file2' \ + 'SUBST_VARS.id= A B' \ + 'SUBST_NOOP_OK.id= no' \ + 'A= a-value' \ + 'B= b-value' \ + '' \ + '.include "prepare-subst.mk"' \ + '.include "mk/subst.mk"' + create_file_lines "file1" "nothing to replace" + create_file_lines "file2" "nothing to replace" + + run_bmake "testcase.mk" "pre-configure" 1> "$tmpdir/out" 2>&1 \ + && exitcode=0 || exitcode=$? + + assert_that "out" --file-is-lines \ + '=> Substituting "id" in file1 file2' \ + 'warning: [subst.mk:id] Nothing changed in ./file1.' \ + 'fail: [subst.mk:id] The pattern file1 has no effect.' \ + '*** Error code 1' \ + '' \ + 'Stop.' \ + "$make: stopped in $PWD" + + test_case_end +fi |