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

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

[nongnu] elpa/parseclj 388bb2bde2 115/185: Fix test case for `\u` and `\


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj 388bb2bde2 115/185: Fix test case for `\u` and `\o` characters
Date: Tue, 28 Dec 2021 14:05:27 -0500 (EST)

branch: elpa/parseclj
commit 388bb2bde2f1985e246d52c3970c8468e03ca69d
Author: Daniel Barreto <daniel.barreto.n@gmail.com>
Commit: Daniel Barreto <daniel.barreto.n@gmail.com>

    Fix test case for `\u` and `\o` characters
    
    Before this commit, reading something like "\u \v \w", would produce two 
char
    tokens, one with "\u \v " and another with "\w".  Test included exemplifies
    solution.
---
 parseclj-lex.el           | 4 ++--
 test/parseclj-lex-test.el | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/parseclj-lex.el b/parseclj-lex.el
index d835457903..1d4f28a5b5 100644
--- a/parseclj-lex.el
+++ b/parseclj-lex.el
@@ -297,11 +297,11 @@ token is returned."
       (right-char 7)
       (parseclj-lex-token :character (buffer-substring-no-properties pos 
(point)) pos))
 
-     ((equal (char-after (point)) ?u)
+     ((string-match-p "^u[0-9a-fA-F]\\{4\\}" (parseclj-lex-lookahead 5))
       (right-char 5)
       (parseclj-lex-token :character (buffer-substring-no-properties pos 
(point)) pos))
 
-     ((equal (char-after (point)) ?o)
+     ((string-match-p "^o[0-8]\\{3\\}" (parseclj-lex-lookahead 4))
       (right-char 4)
       (parseclj-lex-token :character (buffer-substring-no-properties pos 
(point)) pos))
 
diff --git a/test/parseclj-lex-test.el b/test/parseclj-lex-test.el
index bc72bfb7f8..eae02a07af 100644
--- a/test/parseclj-lex-test.el
+++ b/test/parseclj-lex-test.el
@@ -113,6 +113,15 @@
     (should (equal (parseclj-lex-next) (parseclj-lex-token :character "\\b" 
28)))
     (should (equal (parseclj-lex-next) (parseclj-lex-token :character "\\c" 
30))))
 
+  (with-temp-buffer
+    (insert "\\u \\v \\w")
+    (goto-char 1)
+    (should (equal (parseclj-lex-next) (parseclj-lex-token :character "\\u" 
1)))
+    (should (equal (parseclj-lex-next) (parseclj-lex-token :whitespace " " 3)))
+    (should (equal (parseclj-lex-next) (parseclj-lex-token :character "\\v" 
4)))
+    (should (equal (parseclj-lex-next) (parseclj-lex-token :whitespace " " 6)))
+    (should (equal (parseclj-lex-next) (parseclj-lex-token :character "\\w" 
7))))
+
   (with-temp-buffer
     (insert "\\u0078\\o170")
     (goto-char 1)



reply via email to

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