Whitespace cleanup: tab removal in tests directory

Also changed space-based indentation in touched files if they used
4 spaces for indentation (instead of the most-often-used 2).

Also added new line to end of touched files if they did not end
that way.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2015-11-28 21:42:27 +01:00
parent 133fc6adfd
commit ab68d093e8
27 changed files with 282 additions and 282 deletions
@@ -12,5 +12,5 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
var a = new Number(123.5); var a = new Number(123.5);
assert (typeof Object(a) === 'object'); assert (typeof Object(a) === 'object');
+1 -1
View File
@@ -15,5 +15,5 @@
"use strict"; "use strict";
(function () { (function () {
var let = 1; var let = 1;
})(); })();
+6 -6
View File
@@ -18,7 +18,7 @@ var new_arr = array.concat();
assert(new_arr.length === array.length) assert(new_arr.length === array.length)
for (i = 0; i < array.length; i++) { for (i = 0; i < array.length; i++) {
assert(array[i] === new_arr[i]); assert(array[i] === new_arr[i]);
} }
var obj = { concat : Array.prototype.concat }; var obj = { concat : Array.prototype.concat };
@@ -54,7 +54,7 @@ var result = arr1.concat(arr2, arr3, arr4);
assert(result.length === expected.length) assert(result.length === expected.length)
for (i = 0; i < result.length; i++) { for (i = 0; i < result.length; i++) {
assert(result[i] === expected[i]); assert(result[i] === expected[i]);
} }
var arr1 = []; var arr1 = [];
@@ -69,9 +69,9 @@ Object.defineProperty(arr, '0', { 'get' : function () {throw new ReferenceError
arr.length = 1; arr.length = 1;
try { try {
arr.concat(); arr.concat();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+16 -16
View File
@@ -16,19 +16,19 @@
var array = ["foo", [], Infinity, 4]; var array = ["foo", [], Infinity, 4];
function f(arg1, arg2, arg3) { function f(arg1, arg2, arg3) {
assert(arg1 === array[arg2]); assert(arg1 === array[arg2]);
assert(arg3 === array); assert(arg3 === array);
return true; return true;
} }
assert(array.every(f) === true); assert(array.every(f) === true);
function g(arg1, arg2, arg3) { function g(arg1, arg2, arg3) {
if (arg1 === 1) { if (arg1 === 1) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
var arr1 = [1, 1, 1, 1, 1, 2]; var arr1 = [1, 1, 1, 1, 1, 2];
@@ -42,11 +42,11 @@ var obj = { every : Array.prototype.every };
Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.every(f); obj.every(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -54,9 +54,9 @@ var obj = { every : Array.prototype.every, length : 1};
Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.every(f); obj.every(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+17 -17
View File
@@ -16,25 +16,25 @@
var array = ["foo", [], Infinity, 4] var array = ["foo", [], Infinity, 4]
function f(arg1, arg2, arg3) { function f(arg1, arg2, arg3) {
assert(arg1 === array[arg2]); assert(arg1 === array[arg2]);
assert(arg3 === array); assert(arg3 === array);
return true; return true;
} }
var filtered = array.filter(f); var filtered = array.filter(f);
assert(filtered.length === array.length); assert(filtered.length === array.length);
for (i = 0; i < filtered.length; i++) { for (i = 0; i < filtered.length; i++) {
assert(filtered[i] === array[i]); assert(filtered[i] === array[i]);
} }
var array = [1, 2, 3, 4, 5, 6, 7, 8]; var array = [1, 2, 3, 4, 5, 6, 7, 8];
function g (arg1, arg2, arg3) { function g (arg1, arg2, arg3) {
if (arg2 % 2 === 0) { if (arg2 % 2 === 0) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
filtered = array.filter(g) filtered = array.filter(g)
@@ -57,11 +57,11 @@ Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceE
obj.filter = Array.prototype.filter; obj.filter = Array.prototype.filter;
try { try {
obj.filter(f); obj.filter(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -71,9 +71,9 @@ Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError
obj.filter = Array.prototype.filter obj.filter = Array.prototype.filter
try { try {
obj.filter(f); obj.filter(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+10 -10
View File
@@ -16,8 +16,8 @@
var array = ["foo", [], Infinity, 4] var array = ["foo", [], Infinity, 4]
function f(arg1, arg2, arg3) { function f(arg1, arg2, arg3) {
assert(arg1 === array[arg2]); assert(arg1 === array[arg2]);
assert(arg3 === array); assert(arg3 === array);
} }
array.forEach(f); array.forEach(f);
@@ -28,11 +28,11 @@ Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceE
obj.forEach = Array.prototype.forEach; obj.forEach = Array.prototype.forEach;
try { try {
obj.forEach(f); obj.forEach(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -42,9 +42,9 @@ Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError
obj.forEach = Array.prototype.forEach obj.forEach = Array.prototype.forEach
try { try {
obj.forEach(f); obj.forEach(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+17 -17
View File
@@ -48,20 +48,20 @@ var arr = [11, 22, 33, 44];
assert(arr.indexOf(44, 4) === -1); assert(arr.indexOf(44, 4) === -1);
var fromIndex = { var fromIndex = {
toString: function () { toString: function () {
return {}; return {};
}, },
valueOf: function () { valueOf: function () {
return {}; return {};
} }
}; };
try { try {
[0, 1].indexOf(1, fromIndex); [0, 1].indexOf(1, fromIndex);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
// Checking behavior when unable to get length // Checking behavior when unable to get length
@@ -69,11 +69,11 @@ var obj = { indexOf : Array.prototype.indexOf}
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.indexOf("bar"); obj.indexOf("bar");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -81,9 +81,9 @@ var obj = { indexOf : Array.prototype.indexOf, length : 1}
Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.indexOf("bar"); obj.indexOf("bar");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+8 -8
View File
@@ -50,11 +50,11 @@ var obj = { lastIndexOf : Array.prototype.lastIndexOf}
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.lastIndexOf("bar"); obj.lastIndexOf("bar");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -62,9 +62,9 @@ var obj = { lastIndexOf : Array.prototype.lastIndexOf, length : 1}
Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.lastIndexOf("bar"); obj.lastIndexOf("bar");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+12 -12
View File
@@ -37,11 +37,11 @@ var obj = { pop : Array.prototype.pop };
Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.pop(); obj.pop();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to set length // Checking behavior when unable to set length
@@ -49,11 +49,11 @@ var obj = { pop : Array.prototype.pop };
Object.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.pop(); obj.pop();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when no length property defined // Checking behavior when no length property defined
@@ -67,9 +67,9 @@ var obj = { pop : Array.prototype.pop, length : 1 };
Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.pop(); obj.pop();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+7 -7
View File
@@ -45,10 +45,10 @@ assert(a.length === 4294967295);
assert(a[4294967294] === "x"); assert(a[4294967294] === "x");
try { try {
a.push("y"); a.push("y");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert (e instanceof RangeError); assert (e instanceof RangeError);
} }
assert(a.length === 4294967295) assert(a.length === 4294967295)
@@ -59,17 +59,17 @@ assert(o.length === 4294967295);
assert(o[4294967294] === "x"); assert(o[4294967294] === "x");
try { try {
assert(o.push("y") === 4294967296); assert(o.push("y") === 4294967296);
} catch (e) { } catch (e) {
assert(false); assert(false);
} }
assert(o.length === 4294967296); assert(o.length === 4294967296);
assert(o[4294967295] === "y"); assert(o[4294967295] === "y");
try { try {
assert(o.push("z") === 1); assert(o.push("z") === 1);
} catch (e) { } catch (e) {
assert(false); assert(false);
} }
assert(o.length === 1); assert(o.length === 1);
assert(o[0] === "z"); assert(o[0] === "z");
+9 -9
View File
@@ -18,7 +18,7 @@ var array = [4, 3, 2, 1, 0]
array.reverse(); array.reverse();
for (i = 0; i < array.length; i++) { for (i = 0; i < array.length; i++) {
assert(array[i] === i); assert(array[i] === i);
} }
// Checking behavior when unable to get length // Checking behavior when unable to get length
@@ -26,11 +26,11 @@ var obj = { reverse : Array.prototype.reverse };
Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.reverse(); obj.reverse();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -38,9 +38,9 @@ var obj = { reverse : Array.prototype.reverse, length : 3 };
Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.reverse(); obj.reverse();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+14 -14
View File
@@ -34,7 +34,7 @@ assert(array.shift() === undefined);
assert(array.length === 0); assert(array.length === 0);
var referenceErrorThrower = function () { var referenceErrorThrower = function () {
throw new ReferenceError ("foo"); throw new ReferenceError ("foo");
} }
// Checking behavior when unable to get length // Checking behavior when unable to get length
@@ -42,11 +42,11 @@ var obj = { shift : Array.prototype.shift };
Object.defineProperty(obj, 'length', { 'get' : referenceErrorThrower }); Object.defineProperty(obj, 'length', { 'get' : referenceErrorThrower });
try { try {
obj.shift(); obj.shift();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to set length // Checking behavior when unable to set length
@@ -54,11 +54,11 @@ var obj = { shift : Array.prototype.shift };
Object.defineProperty(obj, 'length', { 'set' : referenceErrorThrower }); Object.defineProperty(obj, 'length', { 'set' : referenceErrorThrower });
try { try {
obj.shift(); obj.shift();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when no length property defined // Checking behavior when no length property defined
@@ -72,9 +72,9 @@ var obj = { shift : Array.prototype.shift, length : 1 };
Object.defineProperty(obj, '0', { 'get' : referenceErrorThrower }); Object.defineProperty(obj, '0', { 'get' : referenceErrorThrower });
try { try {
obj.shift(); obj.shift();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+8 -8
View File
@@ -91,11 +91,11 @@ var obj = { slice : Array.prototype.slice };
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.slice(1, 2); obj.slice(1, 2);
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e.message === "foo"); assert (e.message === "foo");
assert (e instanceof ReferenceError); assert (e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -103,9 +103,9 @@ var obj = { length : 1, slice : Array.prototype.slice };
Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.slice(0, 1); obj.slice(0, 1);
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e.message === "foo"); assert (e.message === "foo");
assert (e instanceof ReferenceError); assert (e instanceof ReferenceError);
} }
+16 -16
View File
@@ -16,19 +16,19 @@
var array = ["foo", [], Infinity, 4]; var array = ["foo", [], Infinity, 4];
function f(arg1, arg2, arg3) { function f(arg1, arg2, arg3) {
assert(arg1 === array[arg2]); assert(arg1 === array[arg2]);
assert(arg3 === array); assert(arg3 === array);
return false; return false;
} }
assert(array.some(f) === false); assert(array.some(f) === false);
function g(arg1, arg2, arg3) { function g(arg1, arg2, arg3) {
if (arg1 === 1) { if (arg1 === 1) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
var arr1 = [2, 2, 2, 2, 2, 2]; var arr1 = [2, 2, 2, 2, 2, 2];
@@ -42,11 +42,11 @@ var obj = { some : Array.prototype.some };
Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.some(f); obj.some(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -54,9 +54,9 @@ var obj = { some : Array.prototype.some, length : 1};
Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.some(f); obj.some(f);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+22 -22
View File
@@ -29,23 +29,23 @@ var array = [6, 4, 5, 1, 2, 9, 7, 3, 0, 8];
// Default comparison // Default comparison
array.sort(); array.sort();
for (i = 0; i < array.length; i++) { for (i = 0; i < array.length; i++) {
assert(array[i] === i); assert(array[i] === i);
} }
// Using custom comparison function // Using custom comparison function
function f(arg1, arg2) { function f(arg1, arg2) {
if (arg1 < arg2) { if (arg1 < arg2) {
return 1; return 1;
} else if (arg1 > arg2) { } else if (arg1 > arg2) {
return -1; return -1;
} else { } else {
return 0; return 0;
} }
} }
array.sort(f); array.sort(f);
for (i = 0; i < array.length; i++) { for (i = 0; i < array.length; i++) {
assert(array[array.length - i - 1] === i); assert(array[array.length - i - 1] === i);
} }
// Sorting sparse array // Sorting sparse array
@@ -56,18 +56,18 @@ array.sort();
assert(array.length === expected.length); assert(array.length === expected.length);
for (i = 0; i < array.length; i++) { for (i = 0; i < array.length; i++) {
assert(expected.hasOwnProperty (i) === array.hasOwnProperty (i)); assert(expected.hasOwnProperty (i) === array.hasOwnProperty (i));
assert(array[i] === expected[i]); assert(array[i] === expected[i]);
} }
// Checking behavior when provided comparefn is not callable // Checking behavior when provided comparefn is not callable
var obj = {}; var obj = {};
var arr = []; var arr = [];
try { try {
arr.sort(obj); arr.sort(obj);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
// Checking behavior when unable to get length // Checking behavior when unable to get length
@@ -75,11 +75,11 @@ var obj = { sort : Array.prototype.sort}
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.sort(); obj.sort();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -87,9 +87,9 @@ var obj = { sort : Array.prototype.sort, length : 1}
Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.sort(); obj.sort();
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
+9 -9
View File
@@ -15,7 +15,7 @@
function setDefaultValues() function setDefaultValues()
{ {
return [54, undefined, -127, "sunshine"]; return [54, undefined, -127, "sunshine"];
} }
var array = setDefaultValues(); var array = setDefaultValues();
@@ -156,11 +156,11 @@ var obj = {splice : Array.prototype.splice};
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.splice(1, 2, "item1", "item2"); obj.splice(1, 2, "item1", "item2");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e.message === "foo"); assert (e.message === "foo");
assert (e instanceof ReferenceError); assert (e instanceof ReferenceError);
} }
// Checking behavior when unable to get element // Checking behavior when unable to get element
@@ -168,9 +168,9 @@ var obj = {length : 1, splice : Array.prototype.splice};
Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError ("foo"); } });
try { try {
obj.splice(0, 1, "item1", "item2"); obj.splice(0, 1, "item1", "item2");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e.message === "foo"); assert (e.message === "foo");
assert (e instanceof ReferenceError); assert (e instanceof ReferenceError);
} }
+17 -17
View File
@@ -53,11 +53,11 @@ var obj = { unshift : Array.prototype.unshift };
Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.unshift(1); obj.unshift(1);
assert(false) assert(false)
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable to set length // Checking behavior when unable to set length
@@ -65,11 +65,11 @@ var obj = { unshift : Array.prototype.unshift };
Object.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.unshift(2); obj.unshift(2);
assert(false) assert(false)
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when unable shift elements // Checking behavior when unable shift elements
@@ -77,22 +77,22 @@ var obj = { unshift : Array.prototype.unshift, length : 1 };
Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.unshift(3); obj.unshift(3);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
var obj = { unshift : Array.prototype.unshift, length : 1 }; var obj = { unshift : Array.prototype.unshift, length : 1 };
Object.defineProperty(obj, '0', { 'set' : function () {throw new ReferenceError ("foo"); } }); Object.defineProperty(obj, '0', { 'set' : function () {throw new ReferenceError ("foo"); } });
try { try {
obj.unshift(4); obj.unshift(4);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e.message === "foo"); assert(e.message === "foo");
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
} }
// Checking behavior when a property is not defined // Checking behavior when a property is not defined
@@ -101,4 +101,4 @@ assert(obj.unshift("baz") === 4);
assert(obj[0] === "baz"); assert(obj[0] === "baz");
assert(obj[1] === "foo"); assert(obj[1] === "foo");
assert(obj[2] === undefined); assert(obj[2] === undefined);
assert(obj[3] === "bar"); assert(obj[3] === "bar");
+4 -4
View File
@@ -80,9 +80,9 @@ assert(isNaN(parseFloat(undef)));
var obj = { toString : function () { throw new ReferenceError("foo") } }; var obj = { toString : function () { throw new ReferenceError("foo") } };
try { try {
parseFloat(obj); parseFloat(obj);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
assert(e.message === "foo"); assert(e.message === "foo");
} }
+4 -4
View File
@@ -72,9 +72,9 @@ assert(isNaN(parseInt(undef, arr)));
var obj = { toString : function () { throw new ReferenceError("foo") } }; var obj = { toString : function () { throw new ReferenceError("foo") } };
try { try {
parseInt(obj); parseInt(obj);
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof ReferenceError); assert(e instanceof ReferenceError);
assert(e.message === "foo"); assert(e.message === "foo");
} }
+1 -1
View File
@@ -123,7 +123,7 @@ assert (JSON.stringify (to_json_object) === "3");
function replacer_function (key, value) function replacer_function (key, value)
{ {
if (typeof(value) == "string") if (typeof(value) == "string")
return "FOO"; return "FOO";
return value; return value;
} }
+18 -18
View File
@@ -89,35 +89,35 @@ var digit_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'u', 'v', 'w', 'x', 'y', 'z']; 'u', 'v', 'w', 'x', 'y', 'z'];
for (radix = 2; radix <= 36; radix++) { for (radix = 2; radix <= 36; radix++) {
for (num = 1; num < 100; num++) { for (num = 1; num < 100; num++) {
var value = num; var value = num;
var str = ""; var str = "";
while (value > 0) { while (value > 0) {
str = digit_chars[value % radix] + str; str = digit_chars[value % radix] + str;
value = Math.floor(value / radix); value = Math.floor(value / radix);
} }
assert(str === (num).toString(radix)); assert(str === (num).toString(radix));
} }
} }
try { try {
assert((123).toString(1)); assert((123).toString(1));
assert(false) assert(false)
} catch (e) { } catch (e) {
assert(e instanceof RangeError); assert(e instanceof RangeError);
} }
try { try {
assert((123).toString(37)); assert((123).toString(37));
assert(false) assert(false)
} catch (e) { } catch (e) {
assert(e instanceof RangeError); assert(e instanceof RangeError);
} }
try { try {
assert((123).toString(Infinity)); assert((123).toString(Infinity));
assert(false) assert(false)
} catch (e) { } catch (e) {
assert(e instanceof RangeError); assert(e instanceof RangeError);
} }
+9 -9
View File
@@ -111,24 +111,24 @@ assert (r.ignoreCase === false);
assert (r.multiline === false); assert (r.multiline === false);
try { try {
new RegExp (undefined, "ii"); new RegExp (undefined, "ii");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof SyntaxError); assert (e instanceof SyntaxError);
} }
try { try {
new RegExp ("", "gg"); new RegExp ("", "gg");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof SyntaxError); assert (e instanceof SyntaxError);
} }
try { try {
new RegExp (void 0, "mm"); new RegExp (void 0, "mm");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof SyntaxError); assert (e instanceof SyntaxError);
} }
r = new RegExp (undefined, undefined); r = new RegExp (undefined, undefined);
+21 -21
View File
@@ -28,58 +28,58 @@ t = /\u0000/.exec("\u0000");
assert (t == "\u0000"); assert (t == "\u0000");
try { try {
eval("/" + String.fromCharCode("0x0000") + "/"); eval("/" + String.fromCharCode("0x0000") + "/");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval("var x = 5\n\n/foo/"); eval("var x = 5\n\n/foo/");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof SyntaxError); assert(e instanceof SyntaxError);
} }
try { try {
eval("var x = 5;\n\n/foo/"); eval("var x = 5;\n\n/foo/");
} catch (e) { } catch (e) {
assert(false); assert(false);
} }
try { try {
eval("for (;false;/abc/.exec(\"abc\")) {5}"); eval("for (;false;/abc/.exec(\"abc\")) {5}");
} catch (e) { } catch (e) {
assert(false); assert(false);
} }
try { try {
eval("var a = [] /foo/"); eval("var a = [] /foo/");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof SyntaxError); assert(e instanceof SyntaxError);
} }
try { try {
eval("/"); eval("/");
assert(false); assert(false);
} catch (e) { } catch (e) {
assert(e instanceof SyntaxError); assert(e instanceof SyntaxError);
} }
try { try {
eval("var x = /aaa/"); eval("var x = /aaa/");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval("{}/a/g"); eval("{}/a/g");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval("var a, g; +{}/a/g"); eval("var a, g; +{}/a/g");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
+21 -21
View File
@@ -19,34 +19,34 @@ r = new RegExp ("a");
assert (r.exec ("a") == "a"); assert (r.exec ("a") == "a");
assert (r.exec ("b") == null); assert (r.exec ("b") == null);
try { try {
r.exec.call({}, "a"); r.exec.call({}, "a");
assert (false) assert (false)
} }
catch (e) catch (e)
{ {
assert (e instanceof TypeError); assert (e instanceof TypeError);
} }
assert (r.test ("a") == true); assert (r.test ("a") == true);
assert (r.test ("b") == false); assert (r.test ("b") == false);
try { try {
r.test.call({}, "a"); r.test.call({}, "a");
assert (false) assert (false)
} }
catch (e) catch (e)
{ {
assert (e instanceof TypeError); assert (e instanceof TypeError);
} }
r = new RegExp ("a", "mig"); r = new RegExp ("a", "mig");
assert (r.toString () == "/a/gim"); assert (r.toString () == "/a/gim");
try { try {
r.toString.call({}, "a"); r.toString.call({}, "a");
assert (false) assert (false)
} }
catch (e) catch (e)
{ {
assert (e instanceof TypeError); assert (e instanceof TypeError);
} }
@@ -71,27 +71,27 @@ var re1 = /foo/gim;
var re2 = /bar/g; var re2 = /bar/g;
try { try {
re2.compile("asd", "ggim"); re2.compile("asd", "ggim");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof SyntaxError); assert (e instanceof SyntaxError);
assert (re2 == "/bar/g"); assert (re2 == "/bar/g");
} }
try { try {
re2.compile("[", undefined); re2.compile("[", undefined);
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof SyntaxError); assert (e instanceof SyntaxError);
assert (re2 == "/bar/g"); assert (re2 == "/bar/g");
} }
try { try {
re2.compile(re1, "im"); re2.compile(re1, "im");
assert (false); assert (false);
} catch (e) { } catch (e) {
assert (e instanceof TypeError); assert (e instanceof TypeError);
assert (re2 == "/bar/g"); assert (re2 == "/bar/g");
} }
re2.lastIndex = 2; re2.lastIndex = 2;
+6 -6
View File
@@ -14,19 +14,19 @@
// limitations under the License. // limitations under the License.
try { try {
eval('if (true) /abc/.exec("abc");'); eval('if (true) /abc/.exec("abc");');
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval('if (true) {} /abc/.exec("abc");'); eval('if (true) {} /abc/.exec("abc");');
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval('var a\n/abc/.exec("abc");'); eval('var a\n/abc/.exec("abc");');
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
+6 -6
View File
@@ -14,19 +14,19 @@
// limitations under the License. // limitations under the License.
try { try {
eval("this / 10"); eval("this / 10");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval("var v_0 = 10;\nv_0++ / 1"); eval("var v_0 = 10;\nv_0++ / 1");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
try { try {
eval("var v_0 = 10;\nif (v_0++ / 1) {\n}"); eval("var v_0 = 10;\nif (v_0++ / 1) {\n}");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }
+2 -2
View File
@@ -14,7 +14,7 @@
// limitations under the License. // limitations under the License.
try { try {
eval("if (true) {}\n/a/;"); eval("if (true) {}\n/a/;");
} catch (e) { } catch (e) {
assert (false); assert (false);
} }