Open source the feature tests for the AMP Validator. #997
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is still not integrated with the rest of the AMP build, so
it's piling onto build.py for now, taking the shortest route to
open source this rather than do a lot of internal refactoring first
(to be fair even this took some refactoring ...).
validator.js: Contains the logic for the test. This uses jasmin and
assert.js, the library that comes with NodeJS. I think this library
is fairly weak but for this particular purpose it was the easiest
to use because it keeps our node dependencies inside Google smaller
and the main usage here is to compare with the output of golden files.
On a positive note, validator_test.js is run through the closure
compiler so we have that going for us. The diff in build.py makes
it fairly easy to see what's going on:
with its transitive closure of dependencies, and the actual test method
exported.
nodejs at the top, and a relatively trivial snippet of Javascript to
invoke the test, with the testdata dir as argument.
The tests in testdata/feature_tests are structured so that the .html file
contains descriptive comments explaining what the test is about, and
the .out files contain the validator output for the respective test.