[Pkg-javascript-commits] [uglifyjs] 122/491: add tests for `AST_SymbolAccessor` (#2049)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:27 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 84634da4b5e581c36686082b1071fdf646775f49
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sat Jun 3 16:08:10 2017 +0800

    add tests for `AST_SymbolAccessor` (#2049)
---
 test/compress/properties.js | 87 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 86 insertions(+), 1 deletion(-)

diff --git a/test/compress/properties.js b/test/compress/properties.js
index d49b9ea..a83acc1 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -556,7 +556,75 @@ native_prototype: {
     }
 }
 
-issue_2040: {
+accessor_boolean: {
+    input: {
+        var a = 1;
+        var b = {
+            get true() {
+                return a;
+            },
+            set false(c) {
+                a = c;
+            }
+        };
+        console.log(b.true, b.false = 2, b.true);
+    }
+    expect_exact: 'var a=1;var b={get true(){return a},set false(c){a=c}};console.log(b.true,b.false=2,b.true);'
+    expect_stdout: "1 2 2"
+}
+
+accessor_get_set: {
+    input: {
+        var a = 1;
+        var b = {
+            get set() {
+                return a;
+            },
+            set get(c) {
+                a = c;
+            }
+        };
+        console.log(b.set, b.get = 2, b.set);
+    }
+    expect_exact: 'var a=1;var b={get set(){return a},set get(c){a=c}};console.log(b.set,b.get=2,b.set);'
+    expect_stdout: "1 2 2"
+}
+
+accessor_null_undefined: {
+    input: {
+        var a = 1;
+        var b = {
+            get null() {
+                return a;
+            },
+            set undefined(c) {
+                a = c;
+            }
+        };
+        console.log(b.null, b.undefined = 2, b.null);
+    }
+    expect_exact: 'var a=1;var b={get null(){return a},set undefined(c){a=c}};console.log(b.null,b.undefined=2,b.null);'
+    expect_stdout: "1 2 2"
+}
+
+accessor_number: {
+    input: {
+        var a = 1;
+        var b = {
+            get 42() {
+                return a;
+            },
+            set 42(c) {
+                a = c;
+            }
+        };
+        console.log(b[42], b[42] = 2, b[42]);
+    }
+    expect_exact: 'var a=1;var b={get 42(){return a},set 42(c){a=c}};console.log(b[42],b[42]=2,b[42]);'
+    expect_stdout: "1 2 2"
+}
+
+accessor_string: {
     input: {
         var a = 1;
         var b = {
@@ -572,3 +640,20 @@ issue_2040: {
     expect_exact: 'var a=1;var b={get"a-b"(){return a},set"a-b"(c){a=c}};console.log(b["a-b"],b["a-b"]=2,b["a-b"]);'
     expect_stdout: "1 2 2"
 }
+
+accessor_this: {
+    input: {
+        var a = 1;
+        var b = {
+            get this() {
+                return a;
+            },
+            set this(c) {
+                a = c;
+            }
+        };
+        console.log(b.this, b.this = 2, b.this);
+    }
+    expect_exact: 'var a=1;var b={get this(){return a},set this(c){a=c}};console.log(b.this,b.this=2,b.this);'
+    expect_stdout: "1 2 2"
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list