Add tests for bug 352085, bug 472534, bug 496985, bug 566661, and bug 350712. rs=jwalden

--HG--
extra : rebase_source : eacda0a882d754d4210940625ee7fd3a7c446610
This commit is contained in:
Tom Schuster 2010-12-30 16:40:24 -06:00
parent 32dfb1669c
commit f7fd8ab3b7
6 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,17 @@
var a = function (t) {
return t % 0;
}
var b = function (t) {
return t % "";
}
var c = function (t) {
return t % ("" + "");
}
assertEq(a.toString(), b.toString());
assertEq(a.toString(), c.toString());
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -0,0 +1,30 @@
function monthNames () {
return [
/jan(uar(y)?)?/, 0,
/feb(ruar(y)?)?/, 1,
/m\u00e4r|mar|m\u00e4rz|maerz|march/, 2,
/apr(il)?/, 3,
/ma(i|y)/, 4,
/jun(i|o|e)?/, 5,
/jul(i|y)?/, 6,
/aug(ust)?/, 7,
/sep((t)?(ember))?/, 8,
/o(c|k)t(ober)?/, 9,
/nov(ember)?/, 10,
/de(c|z)(ember)?/, 11
];
};
var actual = '';
var expected = '(jan(uar(y)?)?)|(feb(ruar(y)?)?)|(m\\u00e4r|mar|m\\u00e4rz|maerz|march)|(apr(il)?)|(ma(i|y))|(jun(i|o|e)?)|(jul(i|y)?)|(aug(ust)?)|(sep((t)?(ember))?)|(o(c|k)t(ober)?)|(nov(ember)?)|(de(c|z)(ember)?)';
var mn = monthNames();
for (var i = 0; i < mn.length; ++i) {
if (actual)
actual += '|';
actual += '(' + mn[i++].source + ')';
}
assertEq(actual, expected);
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -0,0 +1,12 @@
var a = function() {
return function ({x: arguments}) {
return arguments;
}
}
var b = eval(uneval(a));
assertEq(a()({x: 1}), 1);
assertEq(b()({x: 1}), 1);
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -0,0 +1,6 @@
var f = function (q) { return q['\xC7']; }
var d = eval(uneval(f));
assertEq(d({'\xC7': 'good'}), 'good');
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -0,0 +1,20 @@
//Bug 350712
function iterator () {
for (var i in []);
}
try {
try {
throw 5;
}
catch(error if iterator()) {
assertEq(false, true);
}
}
catch(error) {
assertEq(error, 5);
}
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -16,3 +16,8 @@ script eval-native-callback-is-indirect.js
script regress-bug607284.js
script Object-keys-and-object-ids.js
fails script nested-delete-name-in-evalcode.js # bug 604301, at a minimum
script bug352085.js
script bug472534.js
script bug496985.js
script bug566661.js
script iterator-in-catch.js