mirror of
https://github.com/servo/servo.git
synced 2025-10-17 08:49:21 +01:00
Update web-platform-tests to revision 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6
This commit is contained in:
parent
39963266ae
commit
ea00d34098
392 changed files with 5974 additions and 7614 deletions
|
@ -1,6 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import abc
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
|
||||
|
@ -13,6 +14,11 @@ if MYPY:
|
|||
Error = Tuple[Text, Text, Text, Optional[int]]
|
||||
|
||||
|
||||
def collapse(text):
|
||||
# type: (Text) -> Text
|
||||
return inspect.cleandoc(str(text)).replace("\n", " ")
|
||||
|
||||
|
||||
class Rule(six.with_metaclass(abc.ABCMeta)):
|
||||
@abc.abstractproperty
|
||||
def name(self):
|
||||
|
@ -55,6 +61,7 @@ class MissingLink(Rule):
|
|||
class PathLength(Rule):
|
||||
name = "PATH LENGTH"
|
||||
description = "/%s longer than maximum path length (%d > 150)"
|
||||
to_fix = "use shorter filename to rename the test file"
|
||||
|
||||
|
||||
class FileType(Rule):
|
||||
|
@ -64,8 +71,9 @@ class FileType(Rule):
|
|||
|
||||
class WorkerCollision(Rule):
|
||||
name = "WORKER COLLISION"
|
||||
description = ("path ends with %s which collides with generated tests "
|
||||
"from %s files")
|
||||
description = collapse("""
|
||||
path ends with %s which collides with generated tests from %s files
|
||||
""")
|
||||
|
||||
|
||||
class GitIgnoreFile(Rule):
|
||||
|
@ -86,8 +94,10 @@ class AhemSystemFont(Rule):
|
|||
# TODO: Add tests for this rule
|
||||
class IgnoredPath(Rule):
|
||||
name = "IGNORED PATH"
|
||||
description = ("%s matches an ignore filter in .gitignore - "
|
||||
"please add a .gitignore exception")
|
||||
description = collapse("""
|
||||
%s matches an ignore filter in .gitignore - please add a .gitignore
|
||||
exception
|
||||
""")
|
||||
|
||||
|
||||
class CSSCollidingTestName(Rule):
|
||||
|
@ -113,6 +123,9 @@ class SupportWrongDir(Rule):
|
|||
class ParseFailed(Rule):
|
||||
name = "PARSE-FAILED"
|
||||
description = "Unable to parse file"
|
||||
to_fix = """
|
||||
examine the file to find the causes of any parse errors, and fix them.
|
||||
"""
|
||||
|
||||
|
||||
class ContentManual(Rule):
|
||||
|
@ -127,8 +140,10 @@ class ContentVisual(Rule):
|
|||
|
||||
class AbsoluteUrlRef(Rule):
|
||||
name = "ABSOLUTE-URL-REF"
|
||||
description = ("Reference test with a reference file specified via an "
|
||||
"absolute URL: '%s'")
|
||||
description = collapse("""
|
||||
Reference test with a reference file specified via an absolute URL:
|
||||
'%s'
|
||||
""")
|
||||
|
||||
|
||||
class SameFileRef(Rule):
|
||||
|
@ -138,33 +153,50 @@ class SameFileRef(Rule):
|
|||
|
||||
class NonexistentRef(Rule):
|
||||
name = "NON-EXISTENT-REF"
|
||||
description = ("Reference test with a non-existent '%s' relationship "
|
||||
"reference: '%s'")
|
||||
description = collapse("""
|
||||
Reference test with a non-existent '%s' relationship reference: '%s'
|
||||
""")
|
||||
|
||||
|
||||
class MultipleTimeout(Rule):
|
||||
name = "MULTIPLE-TIMEOUT"
|
||||
description = "More than one meta name='timeout'"
|
||||
to_fix = """
|
||||
ensure each test file has only one instance of a `<meta
|
||||
name="timeout"...>` element
|
||||
"""
|
||||
|
||||
|
||||
class InvalidTimeout(Rule):
|
||||
name = "INVALID-TIMEOUT"
|
||||
description = "Invalid timeout value %s"
|
||||
description = collapse("""
|
||||
Test file with `<meta name='timeout'...>` element that has a `content`
|
||||
attribute whose value is not `long`: %s
|
||||
""")
|
||||
to_fix = "replace the value of the `content` attribute with `long`"
|
||||
|
||||
|
||||
class MultipleTestharness(Rule):
|
||||
name = "MULTIPLE-TESTHARNESS"
|
||||
description = "More than one <script src='/resources/testharness.js'>"
|
||||
description = "More than one `<script src='/resources/testharness.js'>`"
|
||||
to_fix = """
|
||||
ensure each test has only one `<script
|
||||
src='/resources/testharnessreport.js'>` instance
|
||||
"""
|
||||
|
||||
|
||||
class MissingTestharnessReport(Rule):
|
||||
name = "MISSING-TESTHARNESSREPORT"
|
||||
description = "Missing <script src='/resources/testharnessreport.js'>"
|
||||
description = "Missing `<script src='/resources/testharnessreport.js'>`"
|
||||
to_fix = """
|
||||
ensure each test file contains `<script
|
||||
src='/resources/testharnessreport.js'>`
|
||||
"""
|
||||
|
||||
|
||||
class MultipleTestharnessReport(Rule):
|
||||
name = "MULTIPLE-TESTHARNESSREPORT"
|
||||
description = "More than one <script src='/resources/testharnessreport.js'>"
|
||||
description = "More than one `<script src='/resources/testharnessreport.js'>`"
|
||||
|
||||
|
||||
class PresentTestharnessCSS(Rule):
|
||||
|
@ -174,38 +206,60 @@ class PresentTestharnessCSS(Rule):
|
|||
|
||||
class VariantMissing(Rule):
|
||||
name = "VARIANT-MISSING"
|
||||
description = "<meta name=variant> missing 'content' attribute"
|
||||
description = collapse("""
|
||||
Test file with a `<meta name='variant'...>` element that's missing a
|
||||
`content` attribute
|
||||
""")
|
||||
to_fix = """
|
||||
add a `content` attribute with an appropriate value to the `<meta
|
||||
name='variant'...>` element
|
||||
"""
|
||||
|
||||
|
||||
class MalformedVariant(Rule):
|
||||
name = "MALFORMED-VARIANT"
|
||||
description = ("%s <meta name=variant> 'content' attribute must be the "
|
||||
"empty string or start with '?' or '#'")
|
||||
description = collapse("""
|
||||
%s `<meta name=variant>` 'content' attribute must be the empty string
|
||||
or start with '?' or '#'
|
||||
""")
|
||||
|
||||
|
||||
class LateTimeout(Rule):
|
||||
name = "LATE-TIMEOUT"
|
||||
description = "<meta name=timeout> seen after testharness.js script"
|
||||
description = "`<meta name=timeout>` seen after testharness.js script"
|
||||
description = collapse("""
|
||||
Test file with `<meta name='timeout'...>` element after `<script
|
||||
src='/resources/testharnessreport.js'>` element
|
||||
""")
|
||||
to_fix = """
|
||||
move the `<meta name="timeout"...>` element to precede the `script`
|
||||
element.
|
||||
"""
|
||||
|
||||
|
||||
class EarlyTestharnessReport(Rule):
|
||||
name = "EARLY-TESTHARNESSREPORT"
|
||||
description = "testharnessreport.js script seen before testharness.js script"
|
||||
description = collapse("""
|
||||
Test file has an instance of
|
||||
`<script src='/resources/testharnessreport.js'>` prior to
|
||||
`<script src='/resources/testharness.js'>`
|
||||
""")
|
||||
to_fix = "flip the order"
|
||||
|
||||
|
||||
class MultipleTestdriver(Rule):
|
||||
name = "MULTIPLE-TESTDRIVER"
|
||||
description = "More than one <script src='/resources/testdriver.js'>"
|
||||
description = "More than one `<script src='/resources/testdriver.js'>`"
|
||||
|
||||
|
||||
class MissingTestdriverVendor(Rule):
|
||||
name = "MISSING-TESTDRIVER-VENDOR"
|
||||
description = "Missing <script src='/resources/testdriver-vendor.js'>"
|
||||
description = "Missing `<script src='/resources/testdriver-vendor.js'>`"
|
||||
|
||||
|
||||
class MultipleTestdriverVendor(Rule):
|
||||
name = "MULTIPLE-TESTDRIVER-VENDOR"
|
||||
description = "More than one <script src='/resources/testdriver-vendor.js'>"
|
||||
description = "More than one `<script src='/resources/testdriver-vendor.js'>`"
|
||||
|
||||
|
||||
class TestharnessPath(Rule):
|
||||
|
@ -303,23 +357,35 @@ class Regexp(six.with_metaclass(abc.ABCMeta)):
|
|||
class TabsRegexp(Regexp):
|
||||
pattern = b"^\t"
|
||||
name = "INDENT TABS"
|
||||
description = "Tabs used for indentation"
|
||||
description = "Test-file line starts with one or more tab characters"
|
||||
to_fix = "use spaces to replace any tab characters at beginning of lines"
|
||||
|
||||
class CRRegexp(Regexp):
|
||||
pattern = b"\r$"
|
||||
name = "CR AT EOL"
|
||||
description = "CR character in line separator"
|
||||
description = "Test-file line ends with CR (U+000D) character"
|
||||
to_fix = """
|
||||
reformat file so each line just has LF (U+000A) line ending (standard,
|
||||
cross-platform "Unix" line endings instead of, e.g., DOS line endings).
|
||||
"""
|
||||
|
||||
class SetTimeoutRegexp(Regexp):
|
||||
pattern = br"setTimeout\s*\("
|
||||
name = "SET TIMEOUT"
|
||||
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
|
||||
description = "setTimeout used; step_timeout should typically be used instead"
|
||||
description = "setTimeout used"
|
||||
to_fix = """
|
||||
replace all `setTimeout(...)` calls with `step_timeout(...)` calls
|
||||
"""
|
||||
|
||||
class W3CTestOrgRegexp(Regexp):
|
||||
pattern = br"w3c\-test\.org"
|
||||
name = "W3C-TEST.ORG"
|
||||
description = "External w3c-test.org domain used"
|
||||
description = "Test-file line has the string `w3c-test.org`"
|
||||
to_fix = """
|
||||
either replace the `w3c-test.org` string with the expression
|
||||
`{{host}}:{{ports[http][0]}}` or a generic hostname like `example.org`
|
||||
"""
|
||||
|
||||
class WebPlatformTestRegexp(Regexp):
|
||||
pattern = br"web\-platform\.test"
|
||||
|
@ -335,19 +401,30 @@ class ConsoleRegexp(Regexp):
|
|||
pattern = br"console\.[a-zA-Z]+\s*\("
|
||||
name = "CONSOLE"
|
||||
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
|
||||
description = "Console logging API used"
|
||||
description = "Test-file line has a `console.*(...)` call"
|
||||
to_fix = """
|
||||
remove the `console.*(...)` call (and in some cases, consider adding an
|
||||
`assert_*` of some kind in place of it)
|
||||
"""
|
||||
|
||||
class GenerateTestsRegexp(Regexp):
|
||||
pattern = br"generate_tests\s*\("
|
||||
name = "GENERATE_TESTS"
|
||||
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
|
||||
description = "generate_tests used"
|
||||
description = "Test file line has a generate_tests call"
|
||||
to_fix = "remove the call and call `test()` a number of times instead"
|
||||
|
||||
class PrintRegexp(Regexp):
|
||||
pattern = br"print(?:\s|\s*\()"
|
||||
name = "PRINT STATEMENT"
|
||||
file_extensions = [".py"]
|
||||
description = "Print function used"
|
||||
description = collapse("""
|
||||
A server-side python support file contains a `print` statement
|
||||
""")
|
||||
to_fix = """
|
||||
remove the `print` statement or replace it with something else that
|
||||
achieves the intended effect (e.g., a logging call)
|
||||
"""
|
||||
|
||||
class LayoutTestsRegexp(Regexp):
|
||||
pattern = br"(eventSender|testRunner|internals)\."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue