Skip to content

Commit 507fd38

Browse files
committed
htmldocck: better error messages for negative raw directives
1 parent 78a6e13 commit 507fd38

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/etc/htmldocck.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,14 @@ def check_command(c, cache):
564564
# hasraw/matchesraw <path> <pat> = string test
565565
elif len(c.args) == 2 and "raw" in c.cmd:
566566
cerr = "`PATTERN` did not match"
567+
if c.negated:
568+
cerr = "`PATTERN` unexpectedly matched"
567569
ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp)
568570
# has/matches <path> <pat> <match> = XML tree test
569571
elif len(c.args) == 3 and "raw" not in c.cmd:
570572
cerr = "`XPATH PATTERN` did not match"
573+
if c.negated:
574+
cerr = "`XPATH PATTERN` unexpectedly matched"
571575
ret = get_nb_matching_elements(cache, c, regexp, True) != 0
572576
else:
573577
raise InvalidCheck("Invalid number of {} arguments".format(c.cmd))

0 commit comments

Comments
 (0)