Commit 3cfd80d6 authored by jwolfe's avatar jwolfe Committed by Commit bot

Adjust whitespace to make tests oblivious to --harmony-function-tostring

See discussion in https://codereview.chromium.org/2156303002/#msg8

With the new --harmony-function-tostring behavior, these tests would
fail without this change. This change makes the tests pass regardless
of whether or not --harmony-function-tostring is used.

All of these changes are simply inserting a space after the "function"
keyword to match the current function toString behavior. When
--harmony-function-tostring is enabled, the toString behavior matches
the spacing used in the function declaration. With the declaration
matching the current formatting, the toString behavior becomes
unaffected by --harmony-function-tostring.

BUG=v8:4958
LOG=n

Review-Url: https://codereview.chromium.org/2161413002
Cr-Commit-Position: refs/heads/master@{#37959}
parent 88707c98
......@@ -32,7 +32,7 @@ TEST(SimpleCall2) {
TEST(ConstCall) {
FunctionTester T("(function(foo,a) { return foo(a,3); })");
FunctionTester U("(function(a,b) { return a + b; })");
FunctionTester U("(function (a,b) { return a + b; })");
T.CheckCall(T.Val(6), U.function, T.Val(3));
T.CheckCall(T.Val(6.1), U.function, T.Val(3.1));
......@@ -44,7 +44,7 @@ TEST(ConstCall) {
TEST(ConstCall2) {
FunctionTester T("(function(foo,a) { return foo(a,\"3\"); })");
FunctionTester U("(function(a,b) { return a + b; })");
FunctionTester U("(function (a,b) { return a + b; })");
T.CheckCall(T.Val("33"), U.function, T.Val(3));
T.CheckCall(T.Val("3.13"), U.function, T.Val(3.1));
......
......@@ -357,10 +357,10 @@
(function testNameNotReflectedInToString() {
var f = function() {};
var g = function*() {};
var f = function () {};
var g = function* () {};
var obj = {
['h']: function() {},
['h']: function () {},
i: () => {}
};
assertEquals('function () {}', f.toString());
......
......@@ -348,7 +348,7 @@ assertEquals("start:5 resume:throw1 resume:throw2", log.join(" "));
async function foo() {}
assertEquals("async function foo() {}", foo.toString());
assertEquals("async function () {}", async function() {}.toString());
assertEquals("async function () {}", async function () {}.toString());
assertEquals("async x => x", (async x => x).toString());
assertEquals("async x => { return x }", (async x => { return x }).toString());
class AsyncMethod { async foo() { } }
......
......@@ -200,10 +200,10 @@ assertFalse(math_mirror.property("E").canDelete());
// Test objects with JavaScript accessors.
o = {}
o.__defineGetter__('a', function(){return 'a';});
o.__defineSetter__('b', function(){});
o.__defineGetter__('c', function(){throw 'c';});
o.__defineSetter__('c', function(){throw 'c';});
o.__defineGetter__('a', function (){return 'a';});
o.__defineSetter__('b', function (){});
o.__defineGetter__('c', function (){throw 'c';});
o.__defineSetter__('c', function (){throw 'c';});
testObjectMirror(o, 'Object', 'Object');
mirror = debug.MakeMirror(o);
// a has getter but no setter.
......
......@@ -28,7 +28,7 @@ description(
function foo(o, p) {
var x = o.f;
if (p)
return function() { return x; }
return function () { return x; }
else {
var a = x;
var b = x;
......@@ -36,7 +36,7 @@ function foo(o, p) {
}
}
var o = {f:function() { return 32; }};
var o = {f:function () { return 32; }};
for (var i = 0; i < 100; ++i) {
var expected;
......
......@@ -29,7 +29,7 @@ function foo() {
return x;
}
x = function() { };
x = function () { };
var expected = "\"function () { }\"";
......
......@@ -54,31 +54,31 @@ PASS testThis.apply() is undefined
PASS testThis.call(undefined) is undefined
PASS testThis.apply(undefined) is undefined
PASS (function eval(){'use strict';}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function eval(){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function eval(){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (eval){'use strict';}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (eval){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (eval){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function arguments(){'use strict';}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function arguments(){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function arguments(){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (arguments){'use strict';}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (arguments){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (arguments){'use strict';})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; var eval;}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (){'use strict'; var eval;})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (){'use strict'; var eval;})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; var arguments;}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (){'use strict'; var arguments;})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (){'use strict'; var arguments;})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; try{}catch(eval){}}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (){'use strict'; try{}catch(eval){}})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (){'use strict'; try{}catch(eval){}})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; try{}catch(arguments){}}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){(function (){'use strict'; try{}catch(arguments){}})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){(function (){'use strict'; try{}catch(arguments){}})}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (a, a){'use strict';}) threw exception SyntaxError: Duplicate parameter name not allowed in this context.
PASS (function(){(function (a, a){'use strict';})}) threw exception SyntaxError: Duplicate parameter name not allowed in this context.
PASS (function (){(function (a, a){'use strict';})}) threw exception SyntaxError: Duplicate parameter name not allowed in this context.
PASS (function (a){'use strict'; delete a;})() threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){(function (a){'use strict'; delete a;})()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){(function (a){'use strict'; delete a;})()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; var a; delete a;})() threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){(function (){'use strict'; var a; delete a;})()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){(function (){'use strict'; var a; delete a;})()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){var a; function f() {'use strict'; delete a;} })() threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){(function (){var a; function f() {'use strict'; delete a;} })()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){(function (){var a; function f() {'use strict'; delete a;} })()}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; with(1){};}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function(){(function (){'use strict'; with(1){};})}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function (){(function (){'use strict'; with(1){};})}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function (){'use strict'; arguments.callee; })() threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
PASS (function (){'use strict'; arguments.caller; })() threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
PASS (function f(){'use strict'; f.arguments; })() threw exception TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context..
......@@ -98,37 +98,37 @@ PASS "arguments" in function(){"use strict"} is true
PASS (function(){"use strict";}).hasOwnProperty("arguments") is false
PASS (function(){"use strict";}).__proto__.hasOwnProperty("arguments") is true
PASS 'use strict'; (function (){with(1){};}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function(){'use strict'; (function (){with(1){};})}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function (){'use strict'; (function (){with(1){};})}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS 'use strict'; (function (){var a; delete a;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){'use strict'; (function (){var a; delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; (function (){var a; delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS 'use strict'; var a; (function (){ delete a;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){'use strict'; var a; (function (){ delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; var a; (function (){ delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS var a; (function (){ 'use strict'; delete a;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){var a; (function (){ 'use strict'; delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){var a; (function (){ 'use strict'; delete a;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS 'misc directive'; 'use strict'; with({}){} threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function(){'misc directive'; 'use strict'; with({}){}}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS (function (){'misc directive'; 'use strict'; with({}){}}) threw exception SyntaxError: Strict mode code may not include a with statement.
PASS 'use strict'; return threw exception SyntaxError: Illegal return statement.
PASS 'use strict'; break threw exception SyntaxError: Illegal break statement.
PASS (function(){'use strict'; break}) threw exception SyntaxError: Illegal break statement.
PASS (function (){'use strict'; break}) threw exception SyntaxError: Illegal break statement.
PASS 'use strict'; continue threw exception SyntaxError: Illegal continue statement.
PASS (function(){'use strict'; continue}) threw exception SyntaxError: Illegal continue statement.
PASS (function (){'use strict'; continue}) threw exception SyntaxError: Illegal continue statement.
PASS 'use strict'; for(;;)return threw exception SyntaxError: Illegal return statement.
PASS 'use strict'; for(;;)break missingLabel threw exception SyntaxError: Undefined label 'missingLabel'.
PASS (function(){'use strict'; for(;;)break missingLabel}) threw exception SyntaxError: Undefined label 'missingLabel'.
PASS (function (){'use strict'; for(;;)break missingLabel}) threw exception SyntaxError: Undefined label 'missingLabel'.
PASS 'use strict'; for(;;)continue missingLabel threw exception SyntaxError: Undefined label 'missingLabel'.
PASS (function(){'use strict'; for(;;)continue missingLabel}) threw exception SyntaxError: Undefined label 'missingLabel'.
PASS (function (){'use strict'; for(;;)continue missingLabel}) threw exception SyntaxError: Undefined label 'missingLabel'.
PASS 'use strict'; 007; threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function(){'use strict'; 007;}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function (){'use strict'; 007;}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS 'use strict'; '\007'; threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function(){'use strict'; '\007';}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function (){'use strict'; '\007';}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS '\007'; 'use strict'; threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function(){'\007'; 'use strict';}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS (function (){'\007'; 'use strict';}) threw exception SyntaxError: Octal literals are not allowed in strict mode..
PASS 'use strict'; delete aDeletableProperty; threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){'use strict'; delete aDeletableProperty;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; delete aDeletableProperty;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS 'use strict'; (function (){ delete someDeclaredGlobal;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){'use strict'; (function (){ delete someDeclaredGlobal;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){'use strict'; (function (){ delete someDeclaredGlobal;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){ 'use strict'; delete someDeclaredGlobal;}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function(){(function (){ 'use strict'; delete someDeclaredGlobal;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS (function (){(function (){ 'use strict'; delete someDeclaredGlobal;})}) threw exception SyntaxError: Delete of an unqualified identifier in strict mode..
PASS 'use strict'; if (0) { someGlobal = 'Shouldn\'t be able to assign this.'; }; true; is true
PASS 'use strict'; someGlobal = 'Shouldn\'t be able to assign this.'; threw exception ReferenceError: someGlobal is not defined.
PASS 'use strict'; (function f(){ f = 'shouldn\'t be able to assign to function expression name'; })() threw exception TypeError: Assignment to constant variable..
......@@ -137,44 +137,44 @@ PASS 'use strict'; objectWithReadonlyProperty.prop = 'fail' threw exception Type
PASS 'use strict'; delete objectWithReadonlyProperty.prop threw exception TypeError: Cannot delete property 'prop' of #<Object>.
PASS 'use strict'; delete objectWithReadonlyProperty[readonlyPropName] threw exception TypeError: Cannot delete property 'prop' of #<Object>.
PASS 'use strict'; ++eval threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; ++eval}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; ++eval}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; eval++ threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; eval++}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; eval++}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; --eval threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; --eval}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; --eval}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; eval-- threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; eval--}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; eval--}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; function f() { ++arguments } threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; function f() { ++arguments }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; function f() { ++arguments }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; function f() { arguments++ } threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; function f() { arguments++ }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; function f() { arguments++ }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; function f() { --arguments } threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; function f() { --arguments }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; function f() { --arguments }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; function f() { arguments-- } threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict'; function f() { arguments-- }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict'; function f() { arguments-- }}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS global.eval('"use strict"; if (0) ++arguments; true;') threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; ++(1, eval) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function(){'use strict'; ++(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; ++(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)++ threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function(){'use strict'; (1, eval)++}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)++}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; --(1, eval) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function(){'use strict'; --(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; --(1, eval)}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; (1, eval)-- threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function(){'use strict'; (1, eval)--}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; (1, eval)--}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { ++(1, arguments) } threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function(){'use strict'; function f() { ++(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { ++(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)++ } threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function(){'use strict'; function f() { (1, arguments)++ }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)++ }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS 'use strict'; function f() { --(1, arguments) } threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function(){'use strict'; function f() { --(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS (function (){'use strict'; function f() { --(1, arguments) }}) threw exception ReferenceError: Invalid left-hand side expression in prefix operation.
PASS 'use strict'; function f() { (1, arguments)-- } threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function(){'use strict'; function f() { (1, arguments)-- }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
PASS (function (){'use strict'; function f() { (1, arguments)-- }}) threw exception ReferenceError: Invalid left-hand side expression in postfix operation.
FAIL 'use strict'; undefined; if (0) delete +a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; undefined; if (0) delete +a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete +a.b}.
FAIL (function (){'use strict'; undefined; if (0) delete +a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete +a.b}.
FAIL 'use strict'; undefined; if (0) delete ++a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; undefined; if (0) delete ++a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete ++a.b}.
FAIL (function (){'use strict'; undefined; if (0) delete ++a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete ++a.b}.
FAIL 'use strict'; undefined; if (0) delete void a.b should throw an exception. Was undefined.
FAIL (function(){'use strict'; undefined; if (0) delete void a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete void a.b}.
FAIL (function (){'use strict'; undefined; if (0) delete void a.b}) should throw an exception. Was function (){'use strict'; undefined; if (0) delete void a.b}.
PASS (function (a){'use strict'; a = false; return a !== arguments[0]; })(true) is true
PASS (function (a){'use strict'; arguments[0] = false; return a !== arguments[0]; })(true) is true
PASS (function (a){'use strict'; a=false; return arguments; })(true)[0] is true
......@@ -207,23 +207,23 @@ PASS (function f(arg){'use strict'; var descriptor = Object.getOwnPropertyDescri
PASS (function f(arg){'use strict'; var descriptor = Object.getOwnPropertyDescriptor(f.__proto__, 'arguments'); return descriptor.get === descriptor.set; })() is true
PASS 'use strict'; (function f() { for(var i in this); })(); true; is true
PASS 'use strict'̻ threw exception SyntaxError: Invalid or unexpected token.
PASS (function(){'use strict'̻}) threw exception SyntaxError: Invalid or unexpected token.
PASS (function (){'use strict'̻}) threw exception SyntaxError: Invalid or unexpected token.
PASS 'use strict'5.f threw exception SyntaxError: Invalid or unexpected token.
PASS (function(){'use strict'5.f}) threw exception SyntaxError: Invalid or unexpected token.
PASS (function (){'use strict'5.f}) threw exception SyntaxError: Invalid or unexpected token.
PASS 'use strict';̻ threw exception SyntaxError: Invalid or unexpected token.
PASS (function(){'use strict';̻}) threw exception SyntaxError: Invalid or unexpected token.
PASS (function (){'use strict';̻}) threw exception SyntaxError: Invalid or unexpected token.
PASS 'use strict';5.f threw exception SyntaxError: Invalid or unexpected token.
PASS (function(){'use strict';5.f}) threw exception SyntaxError: Invalid or unexpected token.
PASS (function (){'use strict';5.f}) threw exception SyntaxError: Invalid or unexpected token.
PASS 'use strict';1-(eval=1); threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict';1-(eval=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict';1-(eval=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict';arguments=1; threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict';arguments=1;}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict';arguments=1;}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict';1-(arguments=1); threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict';1-(arguments=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict';1-(arguments=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict';var a=(eval=1); threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict';var a=(eval=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict';var a=(eval=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict';var a=(arguments=1); threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function(){'use strict';var a=(arguments=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS (function (){'use strict';var a=(arguments=1);}) threw exception SyntaxError: Unexpected eval or arguments in strict mode.
PASS 'use strict'; try { throw 1; } catch (e) { aGlobal = true; } is true
PASS 'use strict'; (function () { try { throw 1; } catch (e) { aGlobal = true; }})(); aGlobal; is true
PASS (function () {'use strict'; try { throw 1; } catch (e) { aGlobal = true; }})(); aGlobal; is true
......
......@@ -41,7 +41,7 @@ function testGlobalAccess() {
}
function shouldBeSyntaxError(str) {
shouldThrow(str);
shouldThrow("(function(){" + str + "})");
shouldThrow("(function (){" + str + "})");
}
function testLineContinuation() {
"use stric\
......
......@@ -26,14 +26,14 @@ This test checks that functions re-string-ify in a way that is syntactically com
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
FAIL (function(){return}).toString() should be function () {return;}. Was function (){return}.
FAIL (function(){return }).toString() should be function () {return; }. Was function (){return }.
FAIL (function(){return
FAIL (function (){return}).toString() should be function () {return;}. Was function (){return}.
FAIL (function (){return }).toString() should be function () {return; }. Was function (){return }.
FAIL (function (){return
}).toString() should be function () {return;
}. Was function (){return
}.
FAIL (function(){}).toString() should be function () {}. Was function (){}.
FAIL (function(){ }).toString() should be function () { }. Was function (){ }.
FAIL (function (){}).toString() should be function () {}. Was function (){}.
FAIL (function (){ }).toString() should be function () { }. Was function (){ }.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -26,8 +26,8 @@ description(
"compatible with concatenation."
);
shouldBe("(function(){return}).toString()", "'function () {return;}'");
shouldBe("(function(){return }).toString()", "'function () {return; }'");
shouldBe("(function(){return" + "\n" + "}).toString()", "'function () {return;" + "\\n" + "}'");
shouldBe("(function(){}).toString()", "'function () {}'");
shouldBe("(function(){ }).toString()", "'function () { }'");
shouldBe("(function (){return}).toString()", "'function () {return;}'");
shouldBe("(function (){return }).toString()", "'function () {return; }'");
shouldBe("(function (){return" + "\n" + "}).toString()", "'function () {return;" + "\\n" + "}'");
shouldBe("(function (){}).toString()", "'function () {}'");
shouldBe("(function (){ }).toString()", "'function () { }'");
......@@ -25,19 +25,19 @@ description("KDE JS Test");
// Tests for raising --- and non-raising exceptions on access to reference to undefined things...
// Locals should throw on access if undefined..
fnShouldThrow(function() { a = x; }, ReferenceError);
fnShouldThrow(function () { a = x; }, ReferenceError);
// Read-modify-write versions of assignment should throw as well
fnShouldThrow(function() { x += "foo"; }, ReferenceError);
fnShouldThrow(function () { x += "foo"; }, ReferenceError);
// Other reference types should just return undefined...
a = new Object();
fnShouldNotThrow(function() { b = a.x; });
fnShouldNotThrow(function() { b = a['x']; });
fnShouldNotThrow(function() { a['x'] += 'baz'; });
fnShouldNotThrow(function () { b = a.x; });
fnShouldNotThrow(function () { b = a['x']; });
fnShouldNotThrow(function () { a['x'] += 'baz'; });
shouldBe("a['x']", '"undefinedbaz"');
fnShouldNotThrow(function() { b = a.y; });
fnShouldNotThrow(function() { a.y += 'glarch'; });
fnShouldNotThrow(function () { b = a.y; });
fnShouldNotThrow(function () { a.y += 'glarch'; });
shouldBe("a['y']", '"undefinedglarch"');
......
......@@ -41,304 +41,304 @@ function createTests() {
arrayWithSideEffectGetterAndProto.__defineGetter__("b", function(){this.foo=1;});
arrayWithSideEffectGetterAndProto.__proto__ = {foo:"bar"};
var result = [];
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(1);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(1.5);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(-1);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(-1.5);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(null);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify("string");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Number(0));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Number(1));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Number(1.5));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Number(-1));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Number(-1.5));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new String("a string object"));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Boolean(true));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var value = new Number(1);
value.valueOf = function() { return 2; }
return jsonObject.stringify(value);
});
result[result.length - 1].expected = '2';
result.push(function(jsonObject){
result.push(function (jsonObject){
var value = new Boolean(true);
value.valueOf = function() { return 2; }
return jsonObject.stringify(value);
});
result[result.length - 1].expected = '2';
result.push(function(jsonObject){
result.push(function (jsonObject){
var value = new String("fail");
value.toString = function() { return "converted string"; }
return jsonObject.stringify(value);
});
result[result.length - 1].expected = '"converted string"';
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(true);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(false);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Date(0));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON: Date.prototype.toJSON});
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return "custom toISOString"; }});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return {}; }});
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ throw "An exception"; }});
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
var d = new Date(0);
d.toISOString = null;
return jsonObject.stringify(d);
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
var d = new Date(0);
d.toJSON = undefined;
return jsonObject.stringify(d);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({get Foo() { return "bar"; }});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({get Foo() { this.foo="wibble"; return "bar"; }});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var count = 0;
jsonObject.stringify({get Foo() { count++; return "bar"; }});
return count;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var count = 0;
return jsonObject.stringify({get Foo() { count++; delete this.bar; return "bar"; }, bar: "wibble"});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var count = 0;
return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, function(k,v){allString = allString && (typeof k == "string"); return v});
return allString;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
jsonObject.stringify([1,2,3,4,5], function(k,v){allString = allString && (typeof k == "string"); return v});
return allString;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = [];
return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = ["a"];
return jsonObject.stringify({get a(){return 1;array[1]="b";array[2]="c"}, b:"2", c:"3"}, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
return jsonObject.stringify(simpleObject, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
return jsonObject.stringify(simpleObjectWithProto, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = [1, new Number(2), NaN, Infinity, -Infinity, new String("str")];
return jsonObject.stringify({"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}, array);
});
result[result.length - 1].expected = '{"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}';
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = ["1","2","3"];
return jsonObject.stringify({1:'a', 2:'b', 3:'c'}, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = ["1","2","3"];
return jsonObject.stringify(simpleArray, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArray, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArray, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArray, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArray, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, 10);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, 11);
});
result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, " ");
});
result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObject, null, " ");
});
result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArray, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArray, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArray, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArray, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObject, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObject, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObject, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObject, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = ["1","2","3"];
return jsonObject.stringify(simpleArrayWithProto, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArrayWithProto, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArrayWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArrayWithProto, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleArrayWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, 10);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, 11);
});
result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, " ");
});
result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(simpleObjectWithProto, null, " ");
});
result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArrayWithProto, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArrayWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArrayWithProto, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexArrayWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObjectWithProto, null, " ");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObjectWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObjectWithProto, null, "ab");
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(complexObjectWithProto, null, 4);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(objectWithSideEffectGetter);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(objectWithSideEffectGetterAndProto);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(arrayWithSideEffectGetter);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(arrayWithSideEffectGetterAndProto);
});
var replaceTracker;
......@@ -346,56 +346,56 @@ function createTests() {
replaceTracker += key + "("+(typeof key)+")" + JSON.stringify(value) + ";";
return value;
}
result.push(function(jsonObject){
result.push(function (jsonObject){
replaceTracker = "";
jsonObject.stringify([1,2,3,,,,4,5,6], replaceFunc);
return replaceTracker;
});
result[result.length - 1].expected = '(string)[1,2,3,null,null,null,4,5,6];0(number)1;1(number)2;2(number)3;3(number)undefined;4(number)undefined;5(number)undefined;6(number)4;7(number)5;8(number)6;'
result.push(function(jsonObject){
result.push(function (jsonObject){
replaceTracker = "";
jsonObject.stringify({a:"a", b:"b", c:"c", 3: "d", 2: "e", 1: "f"}, replaceFunc);
return replaceTracker;
});
result[result.length - 1].expected = '(string){"1":"f","2":"e","3":"d","a":"a","b":"b","c":"c"};1(string)"f";2(string)"e";3(string)"d";a(string)"a";b(string)"b";c(string)"c";';
result.push(function(jsonObject){
result.push(function (jsonObject){
var count = 0;
var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
jsonObject.stringify(simpleObject, array);
return count;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var allString = true;
var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];
return jsonObject.stringify(simpleObject, array);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var count = 0;
var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];
jsonObject.stringify(simpleObject, array);
return count;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:"1", get b() { this.a="foo"; return "getter"; }, c:"3"});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:"1", get b() { this.c="foo"; return "getter"; }, c:"3"});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var setterCalled = false;
jsonObject.stringify({a:"1", set b(s) { setterCalled = true; return "setter"; }, c:"3"});
return setterCalled;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:"1", get b(){ return "getter"; }, set b(s) { return "setter"; }, c:"3"});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(new Array(10));
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify([undefined,,null,0,false]);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({p1:undefined,p2:null,p3:0,p4:false});
});
var cycleTracker = "";
......@@ -407,12 +407,12 @@ function createTests() {
toJSON : function(key) { cycleTracker += key + "("+(typeof key)+"):" + this; return this; }
};
cyclicObject.self = cyclicObject;
result.push(function(jsonObject){
result.push(function (jsonObject){
cycleTracker = "";
return jsonObject.stringify(cyclicObject);
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
cycleTracker = "";
try { jsonObject.stringify(cyclicObject); } catch(e) { cycleTracker += " -> exception" }
return cycleTracker;
......@@ -422,12 +422,12 @@ function createTests() {
cyclicArray,
{toJSON : function(key,value) { cycleTracker += key + "("+(typeof key)+"):" + this; cycleTracker += "second,"; return this; }}];
cyclicArray[1] = cyclicArray;
result.push(function(jsonObject){
result.push(function (jsonObject){
cycleTracker = "";
return jsonObject.stringify(cyclicArray);
});
result[result.length - 1].throws = true;
result.push(function(jsonObject){
result.push(function (jsonObject){
cycleTracker = "";
try { jsonObject.stringify(cyclicArray); } catch(e) { cycleTracker += " -> exception" }
return cycleTracker;
......@@ -439,53 +439,53 @@ function createTests() {
get calls() {return ++getterCalls; },
"123":createArray(15, "foo"),
"":{a:"b"}});
result.push(function(jsonObject){
result.push(function (jsonObject){
getterCalls = 0;
return jsonObject.stringify(magicObject) + " :: getter calls = " + getterCalls;
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(undefined);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(null);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON:function(){ return undefined; }});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({toJSON:function(){ return null; }});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify([{toJSON:function(){ return undefined; }}]);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify([{toJSON:function(){ return null; }}]);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:{toJSON:function(){ return undefined; }}});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:{toJSON:function(){ return null; }}});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:{toJSON:function(){ return function(){}; }}});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify({a:function(){}});
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var deepObject = {};
for (var i = 0; i < 1024; i++)
deepObject = {next:deepObject};
return jsonObject.stringify(deepObject);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var deepArray = [];
for (var i = 0; i < 1024; i++)
deepArray = [deepArray];
return jsonObject.stringify(deepArray);
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var depth = 0;
function toDeepVirtualJSONObject() {
if (++depth >= 1024)
......@@ -496,7 +496,7 @@ function createTests() {
}
return jsonObject.stringify(toDeepVirtualJSONObject());
});
result.push(function(jsonObject){
result.push(function (jsonObject){
var depth = 0;
function toDeepVirtualJSONArray() {
if (++depth >= 1024)
......@@ -510,7 +510,7 @@ function createTests() {
var fullCharsetString = "";
for (var i = 0; i < 65536; i++)
fullCharsetString += String.fromCharCode(i);
result.push(function(jsonObject){
result.push(function (jsonObject){
return jsonObject.stringify(fullCharsetString);
});
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment