mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 13:34:38 +02:00
Update parseTestRecord and monkeyYaml to handle new tests
Changes: - Allow zero indent for lists - Handle list with zero elements - Handle public domain license block
This commit is contained in:
parent
36687a502c
commit
9e915f9b3c
@ -71,9 +71,12 @@ def myMultilineList(lines, value):
|
|||||||
leading = myLeadingSpaces(line)
|
leading = myLeadingSpaces(line)
|
||||||
if myIsAllSpaces(line):
|
if myIsAllSpaces(line):
|
||||||
pass
|
pass
|
||||||
elif indent is not None and leading < indent:
|
elif indent is not None and (
|
||||||
|
leading < indent or
|
||||||
|
(leading == indent and line[leading] != "-")
|
||||||
|
):
|
||||||
lines.insert(0, line)
|
lines.insert(0, line)
|
||||||
break;
|
break
|
||||||
else:
|
else:
|
||||||
indent = indent or leading
|
indent = indent or leading
|
||||||
value += [myReadOneLine(myRemoveListHeader(indent, line))]
|
value += [myReadOneLine(myRemoveListHeader(indent, line))]
|
||||||
@ -100,7 +103,10 @@ def myReadOneLine(value):
|
|||||||
|
|
||||||
def myFlowList(value):
|
def myFlowList(value):
|
||||||
result = mYamlListPattern.match(value)
|
result = mYamlListPattern.match(value)
|
||||||
values = result.group(1).split(",")
|
values = result.group(1)
|
||||||
|
if values == "":
|
||||||
|
return []
|
||||||
|
values = values.split(",")
|
||||||
return [myReadOneLine(v.strip()) for v in values]
|
return [myReadOneLine(v.strip()) for v in values]
|
||||||
|
|
||||||
def myMultiline(lines, value):
|
def myMultiline(lines, value):
|
||||||
@ -113,7 +119,7 @@ def myMultiline(lines, value):
|
|||||||
value += ["\n"]
|
value += ["\n"]
|
||||||
elif myLeadingSpaces(line) < indent:
|
elif myLeadingSpaces(line) < indent:
|
||||||
lines.insert(0, line)
|
lines.insert(0, line)
|
||||||
break;
|
break
|
||||||
else:
|
else:
|
||||||
value += [line[(indent):]]
|
value += [line[(indent):]]
|
||||||
value = " ".join(value)
|
value = " ".join(value)
|
||||||
|
@ -29,6 +29,12 @@ _LICENSE_PATTERN = re.compile(
|
|||||||
r'// See LICENSE or https://github\.com/tc39/test262/blob/HEAD/LICENSE' +
|
r'// See LICENSE or https://github\.com/tc39/test262/blob/HEAD/LICENSE' +
|
||||||
r')[\r\n]{1,2}' + _BLANK_LINES, re.IGNORECASE)
|
r')[\r\n]{1,2}' + _BLANK_LINES, re.IGNORECASE)
|
||||||
|
|
||||||
|
_LICENSE_PATTERN_PUBLIC_DOMAIN = re.compile(
|
||||||
|
r'/\*[\r\n]{1,2}' +
|
||||||
|
r' \* Any copyright is dedicated to the Public Domain\.[\r\n]{1,2}' +
|
||||||
|
r' \* http://creativecommons\.org/licenses/publicdomain/[\r\n]{1,2}' +
|
||||||
|
r' \*/[\r\n]{1,2}' + _BLANK_LINES, re.IGNORECASE)
|
||||||
|
|
||||||
yamlLoad = None
|
yamlLoad = None
|
||||||
|
|
||||||
def yamlAttrParser(testRecord, attrs, name, onerror):
|
def yamlAttrParser(testRecord, attrs, name, onerror):
|
||||||
@ -51,10 +57,14 @@ def yamlAttrParser(testRecord, attrs, name, onerror):
|
|||||||
|
|
||||||
def findLicense(src):
|
def findLicense(src):
|
||||||
match = _LICENSE_PATTERN.search(src)
|
match = _LICENSE_PATTERN.search(src)
|
||||||
if not match:
|
if match:
|
||||||
return None
|
return match.group(0)
|
||||||
|
|
||||||
return match.group(0)
|
match = _LICENSE_PATTERN_PUBLIC_DOMAIN.search(src)
|
||||||
|
if match:
|
||||||
|
return match.group(0)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def findAttrs(src):
|
def findAttrs(src):
|
||||||
match = _YAML_PATTERN.search(src)
|
match = _YAML_PATTERN.search(src)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user