mirror of https://github.com/tc39/test262.git
Add assertion messages
This commit is contained in:
parent
1a655779f0
commit
30eca7761b
|
@ -29,6 +29,7 @@ var R_g = /./g, R_y = /./y, R_gy = /./gy;
|
||||||
|
|
||||||
var S = "test";
|
var S = "test";
|
||||||
|
|
||||||
|
var lastIndex;
|
||||||
var bigLastIndexes = [
|
var bigLastIndexes = [
|
||||||
Infinity,
|
Infinity,
|
||||||
Number.MAX_VALUE,
|
Number.MAX_VALUE,
|
||||||
|
@ -43,15 +44,28 @@ var bigLastIndexes = [
|
||||||
5
|
5
|
||||||
];
|
];
|
||||||
for ( var i = 0; i < bigLastIndexes.length; i++ ) {
|
for ( var i = 0; i < bigLastIndexes.length; i++ ) {
|
||||||
R_g.lastIndex = bigLastIndexes[i];
|
lastIndex = bigLastIndexes[i];
|
||||||
R_y.lastIndex = bigLastIndexes[i];
|
R_g.lastIndex = lastIndex;
|
||||||
R_gy.lastIndex = bigLastIndexes[i];
|
R_y.lastIndex = lastIndex;
|
||||||
|
R_gy.lastIndex = lastIndex;
|
||||||
|
|
||||||
assert.sameValue(R_g.exec(S), null);
|
assert.sameValue(R_g.exec(S), null,
|
||||||
assert.sameValue(R_y.exec(S), null);
|
"global RegExp instance must fail to match against '" + S +
|
||||||
assert.sameValue(R_gy.exec(S), null);
|
"' at lastIndex " + lastIndex);
|
||||||
|
assert.sameValue(R_y.exec(S), null,
|
||||||
|
"sticky RegExp instance must fail to match against '" + S +
|
||||||
|
"' at lastIndex " + lastIndex);
|
||||||
|
assert.sameValue(R_gy.exec(S), null,
|
||||||
|
"global sticky RegExp instance must fail to match against '" + S +
|
||||||
|
"' at lastIndex " + lastIndex);
|
||||||
|
|
||||||
assert.sameValue(R_g.lastIndex, 0);
|
assert.sameValue(R_g.lastIndex, 0,
|
||||||
assert.sameValue(R_y.lastIndex, 0);
|
"global RegExp instance lastIndex must be reset after " + lastIndex +
|
||||||
assert.sameValue(R_gy.lastIndex, 0);
|
" exceeds string length");
|
||||||
|
assert.sameValue(R_y.lastIndex, 0,
|
||||||
|
"sticky RegExp instance lastIndex must be reset after " + lastIndex +
|
||||||
|
" exceeds string length");
|
||||||
|
assert.sameValue(R_gy.lastIndex, 0,
|
||||||
|
"global sticky RegExp instance lastIndex must be reset after " + lastIndex +
|
||||||
|
" exceeds string length");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue