Index: test/mjsunit/compiler/literals-assignment.js |
=================================================================== |
--- test/mjsunit/compiler/literals-assignment.js (revision 3110) |
+++ test/mjsunit/compiler/literals-assignment.js (working copy) |
@@ -69,3 +69,32 @@ |
})()"; |
assertEquals(8, eval(code)); |
+// Test object literals. |
+var a, b; |
+a = {x:8}; |
+assertEquals(8, a.x); |
+ |
+b = {x:a, y:"abc"}; |
+assertEquals(a, b.x); |
+assertEquals(8, b.x.x); |
+assertEquals("abc", b.y); |
+ |
+code = "({x:8, y:9}); 10"; |
+assertEquals(10, eval(code)); |
+ |
+code = "({x:8, y:9})"; |
+assertEquals(9, eval(code+".y")); |
+ |
+a = {2:8, x:9}; |
+assertEquals(8, a[2]); |
+assertEquals(8, a["2"]); |
+assertEquals(9, a["x"]); |
+ |
+// Test regexp literals. |
+ |
+a = /abc/; |
+ |
+assertEquals(/abc/, a); |
+ |
+code = "/abc/; 8"; |
+assertEquals(8, eval(code)); |