-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Add automatic labels in test.each() for primitive values in arrays
- Loading branch information
Showing
5 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Automatic labels for test.each() array data where possible | ||
// https://github.com/qunitjs/qunit/issues/1733 | ||
|
||
QUnit.test.each('array of arrays', [[1, 2, 3], [1, 1, 2]], function (assert, _data) { | ||
assert.true(true); | ||
}); | ||
|
||
QUnit.test.each('array of simple strings', [ | ||
'foo', | ||
'x'.repeat(40), | ||
'$', | ||
'http://example.org', | ||
' ', | ||
'' | ||
], function (assert, _data) { | ||
assert.true(true); | ||
}); | ||
|
||
QUnit.test.each('array of mixed', [ | ||
undefined, | ||
null, | ||
false, | ||
true, | ||
0, | ||
1, | ||
-10, | ||
10 / 3, | ||
10e42, | ||
Infinity, | ||
NaN, | ||
[], | ||
{}, | ||
'999: example', | ||
'simple string', | ||
'\b', | ||
'\n', | ||
'y'.repeat(100) | ||
], function (assert, _value) { | ||
assert.true(true); | ||
}); | ||
|
||
QUnit.test.each('keyed objects', { caseFoo: [1, 2, 3], caseBar: [1, 1, 2] }, function (assert, _data) { | ||
assert.true(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# command: ["qunit", "each-array-labels.js"] | ||
|
||
TAP version 13 | ||
ok 1 array of arrays [0] | ||
ok 2 array of arrays [1] | ||
ok 3 array of simple strings [foo] | ||
ok 4 array of simple strings [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] | ||
ok 5 array of simple strings [$] | ||
ok 6 array of simple strings [http://example.org] | ||
ok 7 array of simple strings [ ] | ||
ok 8 array of simple strings [] | ||
ok 9 array of mixed [0: undefined] | ||
ok 10 array of mixed [1: null] | ||
ok 11 array of mixed [2: false] | ||
ok 12 array of mixed [3: true] | ||
ok 13 array of mixed [4: 0] | ||
ok 14 array of mixed [5: 1] | ||
ok 15 array of mixed [6: -10] | ||
ok 16 array of mixed [7: 3.3333333333333335] | ||
ok 17 array of mixed [8: 1e+43] | ||
ok 18 array of mixed [9: Infinity] | ||
ok 19 array of mixed [10: NaN] | ||
ok 20 array of mixed [11] | ||
ok 21 array of mixed [12] | ||
ok 22 array of mixed [13: 999: example] | ||
ok 23 array of mixed [simple string] | ||
ok 24 array of mixed [15] | ||
ok 25 array of mixed [16] | ||
ok 26 array of mixed [17: yyyyyyyyyyyyyyyyyyyyyyyyyyyyy…] | ||
ok 27 keyed objects [caseFoo] | ||
ok 28 keyed objects [caseBar] | ||
1..28 | ||
# pass 28 | ||
# skip 0 | ||
# todo 0 | ||
# fail 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters