emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/js2-mode c1763ab 52/61: add failing tests


From: Dmitry Gutov
Subject: [elpa] externals/js2-mode c1763ab 52/61: add failing tests
Date: Sun, 20 Dec 2020 12:20:11 -0500 (EST)

branch: externals/js2-mode
commit c1763ab0a3f50f523165cc2436d1d0cf66d61774
Author: babenhauserheide <arne.babenhauserheide@disy.net>
Commit: babenhauserheide <arne.babenhauserheide@disy.net>

    add failing tests
---
 tests/parser.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/tests/parser.el b/tests/parser.el
index 094ca29..4fa1950 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -995,6 +995,22 @@ the test."
 (js2-deftest-parse exponentiation-prohibits-unary-op
   "var a = -b ** c" :syntax-error "-b")
 
+;; nullish coalescing, via https://github.com/tc39/proposal-nullish-coalescing
+(js2-deftest-parse nullish-coalescing-operator-null-variable
+  "var a = null; a ?? 1;")
+
+(js2-deftest-parse nullish-coalescing-operator-inexisting-field
+  "var a = {}; a.nonexistant ?? 1;")
+
+(js2-deftest-parse nullish-coalescing-operator-null-value
+  "var b = 1; null ?? b;")
+
+(js2-deftest-parse nullish-coalescing-operator-in-if
+  "if (null ?? b) {
+    return null;
+}")
+
+
 (js2-deftest optional-chaining-operator-on-property-access
   "var a = {}; a?.b;"
   (js2-mode--and-parse)
@@ -1016,21 +1032,6 @@ the test."
     (should node)
     (should (string= (js2-node-text node) "99"))))
 
-;; nullish coalescing, via https://github.com/tc39/proposal-nullish-coalescing
-(js2-deftest nullish-coalescing-operator-null-variable
-  "var a = null; a ?? b;"
-  (js2-mode--and-parse)
-  (let ((node (js2-find-node js2-mode-ast 'js2-name-node-p)))
-    (should node)
-    (should (string= (js2-node-text node) "b"))))
-
-(js2-deftest nullish-coalescing-operator-null-value
-  "null ?? b;"
-  (js2-mode--and-parse)
-  (let ((node (js2-find-node js2-mode-ast 'js2-name-node-p)))
-    (should node)
-    (should (string= (js2-node-text node) "b"))))
-
 (js2-deftest unary-void-node-start
   "var c = void 0"
   (js2-mode--and-parse)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]