diff options
author | Mike Pennisi <mike@mikepennisi.com> | 2016-02-12 12:59:51 -0500 |
---|---|---|
committer | Mike Pennisi <mike@mikepennisi.com> | 2016-02-12 13:03:19 -0500 |
commit | 23d566209a2bccc14d572e0bd81394a9f99ca272 (patch) | |
tree | b9b3656f40cc836ad737eadb627d0930d6695368 /CONTRIBUTING.md | |
parent | 5cb97c293b4a44ee1c31961a07663993c521fb5f (diff) | |
download | qtdeclarative-testsuites-23d566209a2bccc14d572e0bd81394a9f99ca272.tar.gz |
Make asynchronous test configuration explicit
For asynchronous tests, the contract between test file and test runner
is implicit: runners are expected to inspect the source code for
references to a global `$DONE` identifier.
Promote a more explicit contract between test file and test runner by
introducing a new frontmatter "tag", `async`. This brings asynchronous
test configuration in-line with other configuration mechanisms and also
provides a more natural means of test filtering.
The modifications to test files was made programatically using the
`grep` and `sed` utilities:
$ grep "\$DONE" test/ -r --files-with-match --null | \
xargs -0 sed -i 's/^\(flags:\s*\)\[/\1[async, /g'
$ grep "\$DONE" test/ -rl --null | \
xargs -0 grep -E '^flags:' --files-without-match --null | \
xargs -0 sed -i 's/^---\*\//flags: [async]\n---*\//'
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da3971ea5..127673563 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,6 +128,8 @@ This tag is for boolean properties associated with the test. - **`raw`** - execute the test without any modification (no helpers will be available); necessary to test the behavior of directive prologue; implies `noStrict` +- **`async`** - defer interpretation of test results until after the invocation + of the global $DONE` function #### features **features**: [list] @@ -198,7 +200,7 @@ assert.throws(ReferenceError, function() { ## Writing Asynchronous Tests -An asynchronous test is any test that includes the string `$DONE` anywhere in the test file. The test runner checks for the presence of this string; if it is found, the runner expects that the `$DONE()` function will be called to signal test completion. +An asynchronous test is any test that include the `async` frontmatter flag. When executing such tests, the runner expects that the global `$DONE()` function will be called to signal test completion. * If the argument to `$DONE` is omitted, is `undefined`, or is any other falsy value, the test is considered to have passed. |