Index: test/mjsunit/regress/regress-115452.js |
=================================================================== |
--- test/mjsunit/regress/regress-115452.js (revision 11348) |
+++ test/mjsunit/regress/regress-115452.js (working copy) |
@@ -27,22 +27,19 @@ |
// Test that a function declaration cannot overwrite a read-only property. |
-print(0) |
function foobl() {} |
assertTrue(typeof this.foobl == "function"); |
assertTrue(Object.getOwnPropertyDescriptor(this, "foobl").writable); |
-print(1) |
Object.defineProperty(this, "foobl", {value: 1, writable: false}); |
assertSame(1, this.foobl); |
assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable); |
-print(2) |
-eval("function foobl() {}"); |
+// This has to run in global scope, so cannot use assertThrows... |
+try { |
+ eval("function foobl() {}"); // Should throw. |
+ assertUnreachable(); |
+} catch (e) { |
+ assertInstanceof(e, TypeError); |
+} |
assertSame(1, this.foobl); |
-assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable); |
- |
-print(3) |
-eval("function foobl() {}"); |
-assertSame(1, this.foobl); |
-assertFalse(Object.getOwnPropertyDescriptor(this, "foobl").writable); |