OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 assertEquals(void 0, o.value, "test7"); | 113 assertEquals(void 0, o.value, "test7"); |
114 assertEquals(0, x, "test7"); // Global x is undisturbed. | 114 assertEquals(0, x, "test7"); // Global x is undisturbed. |
115 | 115 |
116 | 116 |
117 // Delete on a global property. | 117 // Delete on a global property. |
118 function test8() { | 118 function test8() { |
119 with ({}) { return delete x; } | 119 with ({}) { return delete x; } |
120 } | 120 } |
121 | 121 |
122 assertEquals(true, test8(), "test8"); | 122 assertEquals(true, test8(), "test8"); |
123 assertThrows("x", "test8"); // Global x should be deleted. | 123 assertThrows("x"); // Global x should be deleted. |
124 | 124 |
125 | 125 |
126 // Delete on a property that is not found anywhere. | 126 // Delete on a property that is not found anywhere. |
127 function test9() { | 127 function test9() { |
128 with ({}) { return delete x; } | 128 with ({}) { return delete x; } |
129 } | 129 } |
130 | 130 |
131 assertThrows("x", "test9"); // Make sure it's not there. | 131 assertThrows("x"); // Make sure it's not there. |
132 assertEquals(true, test9(), "test9"); | 132 assertEquals(true, test9(), "test9"); |
133 | 133 |
134 | 134 |
135 // Delete on a DONT_DELETE property of the global object. | 135 // Delete on a DONT_DELETE property of the global object. |
136 var y = 10; | 136 var y = 10; |
137 function test10() { | 137 function test10() { |
138 with ({}) { return delete y; } | 138 with ({}) { return delete y; } |
139 } | 139 } |
140 | 140 |
141 assertEquals(false, test10(), "test10"); | 141 assertEquals(false, test10(), "test10"); |
142 assertEquals(10, y, "test10"); | 142 assertEquals(10, y, "test10"); |
OLD | NEW |