mirror of https://github.com/tc39/test262.git
Throw distinctive errors for different failures
Prior to this patch, two distinct failure cases would produce the same generic error message. Refactor the test logic to report the specific condition which trigger failure.
This commit is contained in:
parent
c324e5c620
commit
47ab262658
|
@ -12,11 +12,12 @@ for (var indexI = 0; indexI <= 65535; indexI++) {
|
|||
if (indexI !== 0x25) {
|
||||
try {
|
||||
var str = String.fromCharCode(indexI);
|
||||
if (decodeURI(str) !== str) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
var differs = decodeURI(str) !== str;
|
||||
} catch (e) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' throws');
|
||||
}
|
||||
if (differs) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' differs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,12 @@ for (var indexI = 0; indexI <= 65535; indexI++) {
|
|||
if (indexI !== 0x25) {
|
||||
try {
|
||||
var str = String.fromCharCode(indexI);
|
||||
if (decodeURIComponent(str) !== str) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
var differs = decodeURIComponent(str) !== str;
|
||||
} catch (e) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' throws');
|
||||
}
|
||||
if (differs) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' differs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,11 @@ for (var indexI = 0; indexI <= 65535; indexI++) {
|
|||
try {
|
||||
var xx = 0;
|
||||
eval("/*var " + String.fromCharCode(indexI) + "xx = 1*/");
|
||||
if (xx !== 0) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
var differs = xx !== 0;
|
||||
} catch (e){
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' throws');
|
||||
}
|
||||
if (differs) {
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' differs');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue