Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: test/webkit/resources/JSON-stringify.js

Issue 2161413002: Adjust whitespace to make tests oblivious to --harmony-function-tostring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/fast/js/kde/lval-exceptions.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/resources/JSON-stringify.js
diff --git a/test/webkit/resources/JSON-stringify.js b/test/webkit/resources/JSON-stringify.js
index 0c406f3bda822c13ebbb4369635bfd330e00e75f..24edafac095c0cecb88d2d65e4dada32149c8d9f 100644
--- a/test/webkit/resources/JSON-stringify.js
+++ b/test/webkit/resources/JSON-stringify.js
@@ -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;
« no previous file with comments | « test/webkit/fast/js/kde/lval-exceptions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698