mirror of https://github.com/tc39/test262.git
Lint: use Python urlparse to verify esid fragment correctness
This commit is contained in:
parent
90c667afd1
commit
ae3493a409
|
@ -1,4 +1,5 @@
|
|||
from ..check import Check
|
||||
from urlparse import urlparse
|
||||
import re
|
||||
|
||||
class CheckEsid(Check):
|
||||
|
@ -8,7 +9,6 @@ class CheckEsid(Check):
|
|||
def __init__(self):
|
||||
#self.es5idRegex = re.compile(r"^S?(B|\d+)(\.\d+)+(-(\d+|[a-z]|i+))*(_A\d(\.\d+)?(_T\d(\.\d+)?)?)?$")
|
||||
self.es6idRegex = re.compile(r"^(S?(B|\d+)(\.\d+)+(((_A\d\.\d)?_T?\d)|[ _]S\d+(\.[a-z])*)?(, |$))+")
|
||||
self.esidRegex = re.compile(r"^(pending|(prod|sec|sup)-[-_A-Za-z0-9.%@]+)$")
|
||||
|
||||
def run(self, name, meta, source):
|
||||
if not meta:
|
||||
|
@ -30,7 +30,7 @@ class CheckEsid(Check):
|
|||
|
||||
if 'esid' in meta:
|
||||
esid = str(meta['esid'])
|
||||
if self.esidRegex.match(esid) == None:
|
||||
parsed = urlparse('#%s' % esid)
|
||||
if parsed.fragment != esid:
|
||||
return 'The `esid` tag has the wrong format: %s' % esid
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
^ expected errors | v input
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: any!thing$goes&-?
|
||||
description: Minimal test
|
||||
---*/
|
||||
|
||||
function f() {}
|
Loading…
Reference in New Issue