|
41 | 41 | `PATH` is relative to the output directory. It can be given as `-`
|
42 | 42 | which repeats the most recently used `PATH`.
|
43 | 43 |
|
44 |
| -* `@has-literal PATH PATTERN` and `@matches-literal PATH PATTERN` checks |
| 44 | +* `@hastext PATH PATTERN` and `@matchestext PATH PATTERN` checks |
45 | 45 | for the occurrence of the given pattern `PATTERN` in the specified file.
|
46 | 46 | Only one occurrence of the pattern is enough.
|
47 | 47 |
|
48 |
| - For `@has-literal`, `PATTERN` is a whitespace-normalized (every consecutive |
| 48 | + For `@hastext`, `PATTERN` is a whitespace-normalized (every consecutive |
49 | 49 | whitespace being replaced by one single space character) string.
|
50 | 50 | The entire file is also whitespace-normalized including newlines.
|
51 | 51 |
|
52 |
| - For `@matches-literal`, `PATTERN` is a Python-supported regular expression. |
| 52 | + For `@matchestext`, `PATTERN` is a Python-supported regular expression. |
53 | 53 | The file remains intact but the regexp is matched without the `MULTILINE`
|
54 | 54 | and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)`
|
55 | 55 | to override them, and `\A` and `\Z` for definitely matching
|
@@ -542,19 +542,19 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first):
|
542 | 542 | def check_command(c, cache):
|
543 | 543 | try:
|
544 | 544 | cerr = ""
|
545 |
| - if c.cmd in ['has', 'has-literal', 'matches', 'matches-literal']: # string test |
| 545 | + if c.cmd in ['has', 'hastext', 'matches', 'matchestext']: # string test |
546 | 546 | regexp = c.cmd.startswith('matches')
|
547 |
| - if len(c.args) == 1 and not regexp and 'literal' not in c.cmd: # @has <path> = file existence |
| 547 | + if len(c.args) == 1 and not regexp and 'text' not in c.cmd: # @has <path> = file existence |
548 | 548 | try:
|
549 | 549 | cache.get_file(c.args[0])
|
550 | 550 | ret = True
|
551 | 551 | except FailedCheck as err:
|
552 | 552 | cerr = str(err)
|
553 | 553 | ret = False
|
554 |
| - elif len(c.args) == 2 and 'literal' in c.cmd: # @has-literal/matches-literal <path> <pat> = string test |
| 554 | + elif len(c.args) == 2 and 'text' in c.cmd: # @hastext/matchestext <path> <pat> = string test |
555 | 555 | cerr = "`PATTERN` did not match"
|
556 | 556 | ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp)
|
557 |
| - elif len(c.args) == 3 and 'literal' not in c.cmd: # @has/matches <path> <pat> <match> = XML tree test |
| 557 | + elif len(c.args) == 3 and 'text' not in c.cmd: # @has/matches <path> <pat> <match> = XML tree test |
558 | 558 | cerr = "`XPATH PATTERN` did not match"
|
559 | 559 | ret = get_nb_matching_elements(cache, c, regexp, True) != 0
|
560 | 560 | else:
|
|
0 commit comments