diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-08-23 01:45:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-23 08:45:39 +0800 |
commit | da85d102e38e84925db37b543a29224ed0cc5231 (patch) | |
tree | f3bc57eca3fd9c280fae2bd4ff31a73f9a97dd48 /test/compress/properties.js | |
parent | 35fe1092d368f3a79df54120d5e1c1dcb268af1a (diff) | |
download | tracifyjs-da85d102e38e84925db37b543a29224ed0cc5231.tar.gz tracifyjs-da85d102e38e84925db37b543a29224ed0cc5231.zip |
enhance `mangle.properties` (#4064)
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, |