Bug 1170716 - Part 3: Use getLastWarning in test for warning with JSEXN_NONE. r=jandem

This commit is contained in:
Tooru Fujisawa 2015-06-11 13:14:14 +09:00
parent e897dd83b1
commit 8d5e07d2d5
5 changed files with 27 additions and 10 deletions

View File

@ -10,8 +10,7 @@ m = new Map(null);
assertEq(m.size, 0);
// FIXME: bug 1083752
options("werror");
assertEq(evaluate("Map()", {catchTermination: true}), "terminated");
assertWarning(() => Map(), "None");
// assertThrowsInstanceOf(() => Map(), TypeError);
// assertThrowsInstanceOf(() => Map(undefined), TypeError);
// assertThrowsInstanceOf(() => Map(null), TypeError);

View File

@ -10,8 +10,7 @@ s = new Set(null);
assertEq(s.size, 0);
// FIXME: bug 1083752
options("werror");
assertEq(evaluate("Set()", {catchTermination: true}), "terminated");
assertWarning(() => Set(), "None");
// assertThrowsInstanceOf(() => Set(), TypeError);
// assertThrowsInstanceOf(() => Set(undefined), TypeError);
// assertThrowsInstanceOf(() => Set(null), TypeError);

View File

@ -7,8 +7,7 @@ new WeakMap(undefined);
new WeakMap(null);
// FIXME: bug 1083752
options("werror");
assertEq(evaluate("WeakMap()", {catchTermination: true}), "terminated");
assertWarning(() => WeakMap(), "None");
// assertThrowsInstanceOf(() => WeakMap(), TypeError);
// assertThrowsInstanceOf(() => WeakMap(undefined), TypeError);
// assertThrowsInstanceOf(() => WeakMap(null), TypeError);

View File

@ -204,3 +204,14 @@ if (typeof assertDeepEq === 'undefined') {
};
})();
}
if (typeof assertWarning === 'undefined') {
function assertWarning(func, name) {
enableLastWarning();
func();
var warning = getLastWarning();
assertEq(warning !== null, true);
assertEq(warning.name, name);
disableLastWarning();
}
}

View File

@ -6,10 +6,19 @@ var summary = 'Add console warnings for non-standard flag argument of String.pro
printBugNumber(BUGNUMBER);
printStatus (summary);
options("werror");
assertEq(evaluate("'aaaA'.match('a', 'i')", {catchTermination: true}), "terminated");
assertEq(evaluate("'aaaA'.search('a', 'i')", {catchTermination: true}), "terminated");
assertEq(evaluate("'aaaA'.replace('a', 'b', 'g')", {catchTermination: true}), "terminated");
function assertWarningForComponent(code, name) {
enableLastWarning();
var g = newGlobal();
g.eval(code);
var warning = getLastWarning();
assertEq(warning !== null, true);
assertEq(warning.name, name);
disableLastWarning();
}
assertWarningForComponent(`'aaaA'.match('a', 'i');`, "None");
assertWarningForComponent(`'aaaA'.search('a', 'i');`, "None");
assertWarningForComponent(`'aaaA'.replace('a', 'b', 'g');`, "None");
if (typeof reportCompare === "function")
reportCompare(true, true);