Update littlecheck

4a3e4c8 Allow inline #CHECK directives and ignore double-commented directives
This commit is contained in:
Johannes Altmanninger
2020-09-26 11:52:00 +02:00
parent fa0c9f90f8
commit f415b3b551
2 changed files with 7 additions and 5 deletions

View File

@@ -14,14 +14,17 @@ import shlex
import subprocess
import sys
# Directives can occur at the beginning of a line, or anywhere in a line that does not start with #.
COMMENT_RE = r'^(?:[^#].*)?#\s*'
# A regex showing how to run the file.
RUN_RE = re.compile(r"\s*#\s*RUN:\s+(.*)\n")
RUN_RE = re.compile(COMMENT_RE + r"RUN:\s+(.*)\n")
# A regex capturing lines that should be checked against stdout.
CHECK_STDOUT_RE = re.compile(r"\s*#\s*CHECK:\s+(.*)\n")
CHECK_STDOUT_RE = re.compile(COMMENT_RE + r"CHECK:\s+(.*)\n")
# A regex capturing lines that should be checked against stderr.
CHECK_STDERR_RE = re.compile(r"\s*#\s*CHECKERR:\s+(.*)\n")
CHECK_STDERR_RE = re.compile(COMMENT_RE + r"CHECKERR:\s+(.*)\n")
class Config(object):

View File

@@ -10,8 +10,7 @@ mkdir b
touch ./b/file.txt
set dirs ./a ./b
echo $dirs/*.txt
# CHECK: ./b/file.txt
echo $dirs/*.txt # CHECK: ./b/file.txt
cd $oldpwd
rm -Rf $dir