Commit Graph

212 Commits

Author SHA1 Message Date
Gus Caplan 833825849d
add lint check for newline at end of file 2019-11-10 20:18:53 -08:00
Mike Pennisi a9111d7144 lint: add rule to verify use of harness files
Verify that every test file which references a harness file using the
"includes" directive also contains at least one reference to a value
defined in the harness file.

To support this check, extend each harness file with a list of values
which it defines.
2019-09-25 14:00:50 -04:00
Mike Pennisi bb5a6622d4 lint: Compute ergonomic name for tests
The command-line interface to Python's "unittest" module allows users to
run tests by name, e.g.

    $ test.py TestLinter.test_foo

If the tests include a period, they cannot be referenced in this way.
Rename the tests to omit the filename extension so that they may be
referenced from the command-line in this way.
2019-09-25 14:00:50 -04:00
Mike Pennisi f38748efc1 lint: Increase isolation between tests and project
Prior to this commit, the tests for the linter partially depended on
project files. This coupling risks churn in the tests: if the needs of
the project change (e.g. a harness file is modified), then the linter
tests would need to be updated. It also made the tests more difficult to
understand because the input was both larger and more complicated than
necessary to exercise the relevant functionality.

Execute the tests in the context of the fixture directory and introduce
minimal support files that serve the same purpose as the corresponding
project files.
2019-09-25 14:00:50 -04:00
Ms2ger 3ff5c0a115 Generation: Support Python 3 (#2288)
* Generation: Use Python 3-compatible imports.

* Generation: Use range() instead of xrange().

* Generation: Use list comprehensions instead of map().

* Generation: Explicitly use bytes in the Test class.

* Generation: Run unit tests on Python 3 as well.
2019-08-14 12:46:23 -04:00
Ms2ger f7896ada9e Lint: Use the print function rather than the statement. 2019-08-12 17:14:07 +02:00
Ms2ger f899f9524c Lint: Use items() rather than iteritems(). 2019-08-12 17:14:07 +02:00
Ms2ger 0b5ff0e151 Lint: Expect bytes rather than unicode from subprocess. 2019-08-12 17:14:07 +02:00
Ms2ger b78cb852e6 Lint: Rename _THROW_STMT_LEGACY to _THROW_STMT_RAW.
'Legacy' implies (to me) that it should no longer be allowed, but the lint
explicitly checks for its presence (in the 'raw' case).
2019-08-12 17:14:07 +02:00
Ms2ger 8946956f19 Lint: Make CheckHarnessFeatures output stable.
The iteration order for a set is not guaranteed to be stable, but this test expected it to be.
2019-08-12 17:14:07 +02:00
Ms2ger c4e5d69044 Tools: Update PyYAML version. (#2279)
Fixes #2278.
2019-08-12 09:49:14 -04:00
Ms2ger 8f5f6a1aa1 tools: update lint.py to work with pip 10+ some more (#2273)
main() and InstallRequirement were also removed from the public API.
2019-08-08 14:11:34 -04:00
Leo Balter 002d3484d6 Add tests for linter 2019-07-15 14:03:25 -04:00
Leo Balter 8b28871eca Update header regexp to prevent year ranges 2019-07-15 14:03:25 -04:00
Aleksey Shvayka a8d4eefa85 Skip hidden files in generator.py (#2183) 2019-05-29 10:58:53 -04:00
Leo Balter 3d4909b0fd
Use .. for git diffs in the CI routines (#2140)
the double dot gets only commits not in the left side of the double dot.

The right side assumes HEAD.

This will allow us to fetch the correct list of new or modified files in the current branch.
2019-04-25 17:56:55 -04:00
Leo Balter ebbe13e2b5
Add CircleCI (#2106)
Transfer Travis jobs to CircleCI
2019-03-20 21:04:41 -04:00
André Bargull c822f4c929 Fix existing linting errors, update error phase, and add a new flags linter (#2086) 2019-03-06 12:24:44 -05:00
André Bargull 41edfcebce Remove old test format parser and simplify yaml frontmatter parsing 2019-02-28 06:39:59 -08:00
Leo Balter e7092eacc4 set lint rules to avoid leading or trailing empty lines in frontmatter string values
Fix #2034
Ref #1997
2019-02-25 16:14:21 -05:00
Leo Balter b4e15b3d5c fix parseTestRecord for optional license header at the top 2019-02-25 15:23:40 -05:00
Leo Balter 0f64e61451 update tests for packaging tools 2019-02-25 15:23:40 -05:00
Leo Balter 8e0c0eac10 Linter should require direct throw statement for raw tests instead of DONOTEVALUATE 2019-02-14 15:06:08 -05:00
Leo Balter 48a7471060 Relax lint check for licensing in files 2019-02-14 15:06:08 -05:00
Leo Balter 7054805941
rename whitelist to exceptions in the linter tool (#2004) 2018-12-18 15:39:57 -02:00
Leo Balter dec4e5df74
Merge pull request #1801 from mathiasbynens/issue-1634
Move `throw "…"` for negative parsing errors to a helper function
2018-11-13 17:23:09 -05:00
Leo Balter d534df2b12 Use travis ci to run new or modified test files on engines 2018-11-07 10:03:00 -05:00
Mathias Bynens 8869799c6d Rebase, regenerate, and update tests 2018-10-23 13:51:17 +02:00
Mathias Bynens b9daa57dcb Rename to $DONOTEVALUATE per @leobalter's suggestion 2018-10-23 13:51:17 +02:00
Mathias Bynens e3feffb01e Move `throw "…"` for negative parsing errors to a helper function
Closes #1634.
2018-10-23 13:51:16 +02:00
Mathias Bynens 73d9169cab Generation: fix more YAML frontmatter writer to eliminate errant newlines from yaml.dump()
This applies the fix from #1821 to the remaining frontmatter properties that consist of lists.

Ref. https://github.com/tc39/test262/pull/1821/files#r222811633.
Ref. #1817.
2018-10-17 10:51:10 -04:00
Mathias Bynens e654d7b2ae Quote variables in ci_build.sh (#1858)
This makes it possible to run the script locally even if `TRAVIS_PULL_REQUEST` is not set.

Currently, it results in an error:

tools/scripts/ci_build.sh: line 2: [: !=: unary operator expected
2018-10-15 11:02:51 -04:00
Rick Waldron 01e67df36e Generation: fix yaml frontmatter writer to eliminate errant newlines from yaml.dump() 2018-10-04 16:21:11 -04:00
Ujjwal Sharma fbd79b10a7 tools: update lint.py to work with pip 10+
Update the lint.py script to work with pip 10+ as pip.req was moved to
pip._internal.req in version 10 onwards and the existing code only works
on versions of pip under or equal to 9.0.3
2018-09-17 13:30:01 -04:00
Rick Waldron ae925f6791 Lint: make esid check allow "%" (#1638) 2018-07-13 16:39:32 -04:00
jugglinmike ac02aa57ff Relax linting rules for `esid` metadata (#1632)
The document fragments used by the ECMAScript specification do not
conform to any particular pattern beyond the grammar defined by the URL
standard [1]. Relax the linting rule to enforce a simplified version of
that grammar.

[1] https://url.spec.whatwg.org/#fragment-state
2018-07-09 12:29:43 -04:00
Rick Waldron 7dc92154af Frontmatter: Adds top level "locale" attribute. Fixes gh-1515 (#1561) 2018-06-19 14:56:30 -04:00
Leo Balter f87f744741
Avoid printing tests source in the lint script (#1602) 2018-06-18 21:09:55 -04:00
Rick Waldron c686cc6099 Lint: disallow calls to verifyConfigurable and verifyProperty in same file 2018-06-07 22:38:36 -04:00
Valerie R Young 40883f4c6a Update filename character restriction in documention, linter and a few filenames 2018-05-11 22:19:01 -04:00
André Bargull 4daa3de9bf Make parseTestRecord.py python3 compatible 2018-04-24 09:52:57 -07:00
jugglinmike 7b01f9799f [generation] Tolerate unicode in source files (#1411) 2018-02-09 11:27:33 -05:00
Rick Waldron 50d840acea Lint: inflect for pluralizing 2018-01-11 10:20:37 -05:00
Rick Waldron 1a057550d8 tools/lint/lib/checks/esid.py: allow "sup-" 2018-01-10 17:32:37 -05:00
Rick Waldron 40cb228633 lint: accept frontmatter without esid, es6id. 2018-01-10 17:25:44 -05:00
Adrian Heine 0278a7d2a5 Add es[56]?id checks 2018-01-10 15:28:58 -05:00
Mike Pennisi e6d674ef7a Rename negative test "phase" for module resolution 2018-01-05 15:17:51 -05:00
Mike Pennisi 136110378b Rename negative test "phase" for parsing
Early errors may result from parsing the source text of a test file, but
they may also result from parsing some other source text as referenced
through the ES2015 module syntax. The latter form of early error is not
necessarily detectable by ECMAScript parsers, however. Because of this,
the label "early" is not sufficiently precise for all Test262 consumers
to correctly interpret all tests.

Update the "phase" name of "early" to "parse" for all those negative
tests that describe errors resulting from parsing of the file's source
text directly. A forthcoming commit will update the remaining tests to
use a "phase" name that is more specific to module resolution.
2018-01-05 15:17:50 -05:00
Adrian Heine 8e7213db38 Remove unused constants in checks/features.py 2018-01-05 12:10:01 -05:00
Rick Waldron 5a791f37f4 tools/lint: install PyYAML if not available. Fixes gh-1286 2017-10-18 12:21:36 -04:00