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

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

[elpa] externals/phps-mode bd08a00 277/405: Added unit test for COALESCI


From: Stefan Monnier
Subject: [elpa] externals/phps-mode bd08a00 277/405: Added unit test for COALESCING EQUAL token
Date: Sat, 13 Jul 2019 10:00:31 -0400 (EDT)

branch: externals/phps-mode
commit bd08a00c85de0d2c439ee094f3cdd5b1a1ab7b92
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added unit test for COALESCING EQUAL token
---
 README.md               | 2 +-
 phps-mode-test-lexer.el | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 58be432..72ae7d6 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@ This mode does not require PHP installed on computer because 
it has a elisp base
 
 * GPLv3 license (100%)
 * Flycheck support (PHP Mess Detector, PHP Code Sniffer) (100%)
+* Lexer based on official PHP re2c lexer (100%)
 * Syntax coloring based on lexer tokens (100%)
 * PSR-1 and PSR-2 indentation based on lexer tokens (100%)
-* Lexer based on official PHP re2c lexer (100%)
 * Imenu support (100%)
 * Incremental lexer and syntax coloring after buffer changes (75%)
 * Incremental indentation and imenu calculation after buffer changes (50%)
diff --git a/phps-mode-test-lexer.el b/phps-mode-test-lexer.el
index aef31e5..61b5e2d 100644
--- a/phps-mode-test-lexer.el
+++ b/phps-mode-test-lexer.el
@@ -161,7 +161,13 @@
    (should (equal (phps-mode-lexer-get-tokens)
                   '((T_OPEN_TAG 1 . 7) (T_STRING 7 . 18) ("(" 18 . 19) 
(T_VARIABLE 19 . 24) ("," 24 . 25) (T_VARIABLE 26 . 31) (")" 31 . 32)))))
 
-  ;; TODO Add test for ??= token
+  (phps-mode-test-with-buffer
+   "<?php\n$username = $_GET['user'] ?? 'nobody';\n$username ??= $_GET['user'] 
: 'nobody2';\n"
+   "Coalescing operator and coalescing assignment"
+   ;; (message "Tokens: %s" (phps-mode-lexer-get-tokens))
+   (should (equal (phps-mode-lexer-get-tokens)
+                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 16) ("=" 17 . 18) 
(T_VARIABLE 19 . 24) ("[" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 31) ("]" 31 
. 32) (T_COALESCE 33 . 35) (T_CONSTANT_ENCAPSED_STRING 36 . 44) (";" 44 . 45) 
(T_VARIABLE 46 . 55) (T_COALESCE_EQUAL 56 . 59) (T_VARIABLE 60 . 65) ("[" 65 . 
66) (T_CONSTANT_ENCAPSED_STRING 66 . 72) ("]" 72 . 73) (":" 74 . 75) 
(T_CONSTANT_ENCAPSED_STRING 76 . 85) (";" 85 . 86)))))
+
   ;; TODO Add test for long as var offset
 
   ;; (phps-mode-test-with-buffer



reply via email to

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