Update filename character restriction in documention, linter and a few filenames

This commit is contained in:
Valerie R Young 2018-05-02 16:14:31 -04:00 committed by Mike Pennisi
parent 8d7dd538f1
commit 40883f4c6a
7 changed files with 26 additions and 1 deletions

View File

@ -10,7 +10,7 @@
Test cases should be created in files that are named to identify the feature or API that's being tested.
There is no strict naming convention. The file names should be human readable, helpful and, ideally, consistent within a single directory. For examples:
The names should use alphanumeric characters and `.`, `-`, `_`. Otherwise, there is no strict naming convention, but the file names should be human readable, helpful and, ideally, consistent within a single directory. For examples:
- `Math.fround` handling of `Infinity`: `test/built-ins/Math/fround/Math.fround_Infinity.js`
- `Array.prototype.find` use with `Proxy`: `test/built-ins/Array/prototype/find/Array.prototype.find_callable-Proxy-1.js`

View File

@ -0,0 +1,13 @@
import re
from ..check import Check
_DISALLOWED_PATTERN = re.compile('[^a-zA-Z0-9/\\-_.]')
class CheckFileName(Check):
'''Ensure tests have a valid name.'''
ID = 'FILENAME'
def run(self, name, meta, source):
if _DISALLOWED_PATTERN.search(name):
return "Contains non-alphanumeric or `-`, `_`, '.' characters."

View File

@ -32,6 +32,7 @@ from lib.checks.frontmatter import CheckFrontmatter
from lib.checks.harnessfeatures import CheckHarnessFeatures
from lib.checks.license import CheckLicense
from lib.checks.negative import CheckNegative
from lib.checks.filename import CheckFileName
from lib.eprint import eprint
import lib.frontmatter
import lib.whitelist
@ -46,6 +47,7 @@ parser.add_argument('path',
checks = [
CheckEsid(),
CheckFileName(),
CheckFrontmatter(),
CheckFeatures('features.txt'),
CheckHarnessFeatures(),

View File

@ -0,0 +1,10 @@
FILENAME
^ expected errors | v input
// Copyright (c) 2018 Valerie Young. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
esid: sec-assignment-operators-static-semantics-early-errors
description: Minimal test
---*/
void 0;