make(1): precisely describe the expected output in the test moderrs.mk

By making "want:" the same length as "make:", the remaining text in
these lines can be compared easily.
This commit is contained in:
rillig 2020-11-01 10:50:22 +00:00
parent 897c76e5e1
commit 598a8d140a
2 changed files with 24 additions and 17 deletions

View File

@ -1,32 +1,33 @@
modunkn:
Expect: Unknown modifier 'Z'
want: Unknown modifier 'Z'
make: Unknown modifier 'Z'
VAR:Z=
modunknV:
Expect: Unknown modifier 'Z'
want: Unknown modifier 'Z'
make: Unknown modifier 'Z'
VAR:Z=
varterm:
Expect: Unclosed variable specification for VAR
want: Unclosed variable specification (expecting '}') for "VAR" (value "Thevariable") modifier S
make: Unclosed variable specification (expecting '}') for "VAR" (value "Thevariable") modifier S
VAR:S,V,v,=Thevariable
vartermV:
Expect: Unclosed variable specification for VAR
want: Unclosed variable specification after complex modifier (expecting '}') for VAR
make: Unclosed variable specification after complex modifier (expecting '}') for VAR
VAR:S,V,v,=Thevariable
modtermV:
Expect: Unfinished modifier for VAR (',' missing)
want: Unfinished modifier for VAR (',' missing)
make: Unfinished modifier for VAR (',' missing)
VAR:S,V,v=
modloop:
Expect: 2 errors about missing @ delimiter
want: Unfinished modifier for UNDEF ('@' missing)
make: Unfinished modifier for UNDEF ('@' missing)
want: Unfinished modifier for UNDEF ('@' missing)
make: Unfinished modifier for UNDEF ('@' missing)
1 2 3
@ -37,18 +38,20 @@ make: Unclosed variable specification (expecting '}') for "UNDEF" (value "1}...
1}... 2}... 3}...
modwords:
Expect: 2 errors about missing ] delimiter
want: Unfinished modifier for UNDEF (']' missing)
make: Unfinished modifier for UNDEF (']' missing)
want: Unfinished modifier for UNDEF (']' missing)
make: Unfinished modifier for UNDEF (']' missing)
13=
12345=ok
modexclam:
Expect: 2 errors about missing ! delimiter
want: Unfinished modifier for VARNAME ('!' missing)
make: Unfinished modifier for VARNAME ('!' missing)
want: Unfinished modifier for ! ('!' missing)
make: Unfinished modifier for ! ('!' missing)

View File

@ -1,7 +1,8 @@
# $NetBSD: moderrs.mk,v 1.19 2020/11/01 10:46:34 rillig Exp $
# $NetBSD: moderrs.mk,v 1.20 2020/11/01 10:50:22 rillig Exp $
#
# various modifier error tests
'= '\''
VAR= TheVariable
# in case we have to change it ;-)
MOD_UNKN= Z
@ -24,28 +25,29 @@ all: mod-remember-parse
all: mod-sysv-parse
modunkn: print-header print-footer
@echo "Expect: Unknown modifier 'Z'"
@echo 'want: Unknown modifier $'Z$''
@echo "VAR:Z=${VAR:Z}"
modunknV: print-header print-footer
@echo "Expect: Unknown modifier 'Z'"
@echo 'want: Unknown modifier $'Z$''
@echo "VAR:${MOD_UNKN}=${VAR:${MOD_UNKN}}"
varterm: print-header print-footer
@echo "Expect: Unclosed variable specification for VAR"
@echo 'want: Unclosed variable specification (expecting $'}$') for "VAR" (value "Thevariable") modifier S'
@echo VAR:S,V,v,=${VAR:S,V,v,
vartermV: print-header print-footer
@echo "Expect: Unclosed variable specification for VAR"
@echo 'want: Unclosed variable specification after complex modifier (expecting $'}$') for VAR'
@echo VAR:${MOD_TERM},=${VAR:${MOD_S}
modtermV: print-header print-footer
@echo "Expect: Unfinished modifier for VAR (',' missing)"
@echo 'want: Unfinished modifier for VAR ($',$' missing)'
-@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}"
modloop: print-header print-footer
@echo "Expect: 2 errors about missing @ delimiter"
@echo 'want: Unfinished modifier for UNDEF ($'@$' missing)'
@echo ${UNDEF:U1 2 3:@var}
@echo 'want: Unfinished modifier for UNDEF ($'@$' missing)'
@echo ${UNDEF:U1 2 3:@var@...}
@echo ${UNDEF:U1 2 3:@var@${var}@}
@ -60,8 +62,9 @@ modloop-close: print-header print-footer
@echo ${UNDEF:U1 2 3:@var@${var}}...@}
modwords: print-header print-footer
@echo "Expect: 2 errors about missing ] delimiter"
@echo 'want: Unfinished modifier for UNDEF ($']$' missing)'
@echo ${UNDEF:U1 2 3:[}
@echo 'want: Unfinished modifier for UNDEF ($']$' missing)'
@echo ${UNDEF:U1 2 3:[#}
# out of bounds => empty
@ -81,12 +84,13 @@ modwords: print-header print-footer
@echo 12345=${UNDEF:U1 2 3:[123451234512345123451234512345]:S,^$,ok,:S,^3$,ok,}
modexclam: print-header print-footer
@echo "Expect: 2 errors about missing ! delimiter"
@echo 'want: Unfinished modifier for VARNAME ($'!$' missing)'
@echo ${VARNAME:!echo}
# When the final exclamation mark is missing, there is no
# fallback to the SysV substitution modifier.
# If there were a fallback, the output would be "exclam",
# and the above would have produced an "Unknown modifier '!'".
@echo 'want: Unfinished modifier for ! ($'!$' missing)'
@echo ${!:L:!=exclam}
mod-subst-delimiter: print-header print-footer