Index: test/mjsunit/json.js |
diff --git a/test/mjsunit/json.js b/test/mjsunit/json.js |
index 47582643c6ab3a93fb323bea927637851f31ba61..bf44f7814ee640225b0f05f966b1de74ecda9cf2 100644 |
--- a/test/mjsunit/json.js |
+++ b/test/mjsunit/json.js |
@@ -195,3 +195,13 @@ assertEquals('{"y":6,"x":5}', JSON.stringify({x:5,y:6}, ['y', 'x'])); |
assertEquals(undefined, JSON.stringify(undefined)); |
assertEquals(undefined, JSON.stringify(function () { })); |
+ |
+function checkIllegal(str) { |
+ assertThrows(function () { JSON.parse(str); }, SyntaxError); |
+} |
+ |
+checkIllegal('1); throw "foo"; (1'); |
+ |
+var x = 0; |
+eval("(1); x++; (1)"); |
+checkIllegal('1); x++; (1'); |