diff options
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r-- | test/compress/properties.js | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js index af57c6b9..169dcd11 100644 --- a/test/compress/properties.js +++ b/test/compress/properties.js @@ -130,7 +130,7 @@ evaluate_string_length: { } } -mangle_properties: { +mangle_properties_1: { mangle = { properties: { keep_quoted: false, @@ -152,6 +152,53 @@ mangle_properties: { } } +mangle_properties_2: { + mangle = { + properties: { + reserved: [ + "value", + ] + }, + } + input: { + var o = { + prop1: 1, + }; + Object.defineProperty(o, "prop2", { + value: 2, + }); + Object.defineProperties(o, { + prop3: { + value: 3, + }, + }); + console.log("prop1", o.prop1, "prop1" in o); + console.log("prop2", o.prop2, o.hasOwnProperty("prop2")); + console.log("prop3", o.prop3, Object.getOwnPropertyDescriptor(o, "prop3").value); + } + expect: { + var o = { + o: 1, + }; + Object.defineProperty(o, "p", { + value: 2, + }); + Object.defineProperties(o, { + r: { + value: 3, + }, + }); + console.log("prop1", o.o, "o" in o); + console.log("prop2", o.p, o.hasOwnProperty("p")); + console.log("prop3", o.r, Object.getOwnPropertyDescriptor(o, "r").value); + } + expect_stdout: [ + "prop1 1 true", + "prop2 2 true", + "prop3 3 3", + ] +} + mangle_unquoted_properties: { options = { evaluate: true, |