Chromium Code Reviews| Index: test/mjsunit/strict-mode.js |
| diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js |
| index 6b775fcb049409469a423e7ad58a1fd7582cb644..a4ee01dbe953dd4d5d364c2365622deb1ddb6809 100644 |
| --- a/test/mjsunit/strict-mode.js |
| +++ b/test/mjsunit/strict-mode.js |
| @@ -264,6 +264,14 @@ CheckStrictMode("function strict() { print(--arguments); }", SyntaxError); |
| CheckStrictMode("function strict() { var x = --eval; }", SyntaxError); |
| CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError); |
| +// Delete of an unqialified identifier |
|
Mads Ager (chromium)
2011/02/14 10:27:24
unqialified -> unqualified
Martin Maly
2011/02/14 21:46:51
Done.
|
| +CheckStrictMode("delete unqualified;", SyntaxError); |
| +CheckStrictMode("function strict() { delete unqualified; }", SyntaxError); |
| +CheckStrictMode("function function_name() { delete function_name; }", SyntaxError); |
|
Mads Ager (chromium)
2011/02/14 10:27:24
Make these 80 char lines?
Martin Maly
2011/02/14 21:46:51
Done.
|
| +CheckStrictMode("function strict(parameter) { delete parameter; }", SyntaxError); |
| +CheckStrictMode("function strict() { var variable; delete variable; }", SyntaxError); |
| +CheckStrictMode("var variable; delete variable;", SyntaxError); |
| + |
| // Prefix unary operators other than delete, ++, -- are valid in strict mode |
| (function StrictModeUnaryOperators() { |
| "use strict"; |
| @@ -374,3 +382,33 @@ delete possibly_undefined_variable_for_strict_mode_test; |
| repeat(10, function() { testAssignToUndefined(true); }); |
| possibly_undefined_variable_for_strict_mode_test = undefined; |
| repeat(10, function() { testAssignToUndefined(false); }); |
| + |
| +(function testDeleteNonConfigurable() { |
| + function delete_property(o) { |
| + "use strict"; |
| + delete o.property; |
| + } |
| + function delete_element(o, i) { |
| + "use strict"; |
| + delete o[i]; |
| + } |
| + |
| + var object = {}; |
| + |
| + Object.defineProperty(object, "property", { value: "property_value" }); |
| + Object.defineProperty(object, "1", { value: "one" }); |
| + Object.defineProperty(object, 7, { value: "seven" }); |
| + Object.defineProperty(object, 3.14, { value: "pi" }); |
| + |
| + assertThrows(function() { delete_property(object); }, TypeError); |
| + assertEquals(object.property, "property_value"); |
| + assertThrows(function() { delete_element(object, "1"); }, TypeError); |
| + assertThrows(function() { delete_element(object, 1); }, TypeError); |
| + assertEquals(object[1], "one"); |
| + assertThrows(function() { delete_element(object, "7"); }, TypeError); |
| + assertThrows(function() { delete_element(object, 7); }, TypeError); |
| + assertEquals(object[7], "seven"); |
| + assertThrows(function() { delete_element(object, "3.14"); }, TypeError); |
| + assertThrows(function() { delete_element(object, 3.14); }, TypeError); |
| + assertEquals(object[3.14], "pi"); |
| +})(); |