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

Side by Side Diff: test/mjsunit/json.js

Issue 165446: Fixed issue 19212 (Closed)
Patch Set: Fixed lint problem Created 11 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 assertEquals("[[],[],[]]", JSON.stringify(multiOccurrence)); 188 assertEquals("[[],[],[]]", JSON.stringify(multiOccurrence));
189 189
190 assertEquals('{"x":5,"y":6}', JSON.stringify({x:5,y:6})); 190 assertEquals('{"x":5,"y":6}', JSON.stringify({x:5,y:6}));
191 assertEquals('{"x":5}', JSON.stringify({x:5,y:6}, ['x'])); 191 assertEquals('{"x":5}', JSON.stringify({x:5,y:6}, ['x']));
192 assertEquals('{\n "a": "b",\n "c": "d"\n}', 192 assertEquals('{\n "a": "b",\n "c": "d"\n}',
193 JSON.stringify({a:"b",c:"d"}, null, 1)); 193 JSON.stringify({a:"b",c:"d"}, null, 1));
194 assertEquals('{"y":6,"x":5}', JSON.stringify({x:5,y:6}, ['y', 'x'])); 194 assertEquals('{"y":6,"x":5}', JSON.stringify({x:5,y:6}, ['y', 'x']));
195 195
196 assertEquals(undefined, JSON.stringify(undefined)); 196 assertEquals(undefined, JSON.stringify(undefined));
197 assertEquals(undefined, JSON.stringify(function () { })); 197 assertEquals(undefined, JSON.stringify(function () { }));
198
199 function checkIllegal(str) {
200 assertThrows(function () { JSON.parse(str); }, SyntaxError);
201 }
202
203 checkIllegal('1); throw "foo"; (1');
204
205 var x = 0;
206 eval("(1); x++; (1)");
207 checkIllegal('1); x++; (1');
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698