branch: elpa/racket-mode
commit 06fb64180f3f3727008e70aa62829ff00f473390
Author: Greg Hendershott <g...@greghendershott.com>
Commit: Greg Hendershott <g...@greghendershott.com>

    Update test for rhombus lexer change
---
 test/racket/hash-lang-test.rkt | 47 +++++++++++++++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/test/racket/hash-lang-test.rkt b/test/racket/hash-lang-test.rkt
index 14888b2cc1..561c2d0b42 100644
--- a/test/racket/hash-lang-test.rkt
+++ b/test/racket/hash-lang-test.rkt
@@ -456,18 +456,41 @@
   (let* ([o (test-create "#lang rhombus\n@//{block comment}")]
          ;;               01234567890123 4567890123456789012
          ;;                         1          2         3
-         [gen-1-tokens (send o get-tokens 1)])
-    (check-equal? (test-update! o 2 16 0 " ")
-                  '((14 15 #hasheq((invisible-open-count . 1) (rhombus-type . 
at) (type . at)))
-                    (15 16 #hasheq((rhombus-type . operator) (type . 
operator)))
-                    (16 17 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
-                    (17 18 #hasheq((rhombus-type . operator) (type . 
operator)))
-                    (18 19 #hasheq((rhombus-type . opener) (type . 
parenthesis)))
-                    (19 24 #hasheq((invisible-open-count . 1) (rhombus-type . 
identifier) (type . symbol)))
-                    (24 25 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
-                    (25 32 #hasheq((invisible-close-count . 1) (rhombus-type . 
identifier) (type . symbol)))
-                    (32 33 #hasheq((invisible-close-count . 1) (rhombus-type . 
closer) (type . parenthesis))))
-                  "non-zero backup amounts are used: edit removes block 
comment")
+         [gen-1-tokens (send o get-tokens 1)]
+         [gen-2-tokens (test-update! o 2 16 0 " ")])
+    (check-true
+     (or
+      ;; Older rhombus-lexer
+      (equal? gen-2-tokens
+              '((14 15 #hasheq((invisible-open-count . 1) (rhombus-type . at) 
(type . at)))
+                (15 16 #hasheq((rhombus-type . operator) (type . operator)))
+                (16 17 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
+                (17 18 #hasheq((rhombus-type . operator) (type . operator)))
+                (18 19 #hasheq((rhombus-type . opener) (type . parenthesis)))
+                (19 24 #hasheq((invisible-open-count . 1)
+                               (rhombus-type . identifier)
+                               ;; older rhombus lexers don't supply
+                               ;; semantic-type-guess mapping here
+                               (type . symbol)))
+                (24 25 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
+                (25 32 #hasheq((invisible-close-count . 1) (rhombus-type . 
identifier) (type . symbol)))
+                (32 33 #hasheq((invisible-close-count . 1) (rhombus-type . 
closer) (type . parenthesis)))))
+      ;; Newer rhombus-lexer
+      (equal? gen-2-tokens
+              '((14 15 #hasheq((invisible-open-count . 1) (rhombus-type . at) 
(type . at)))
+                (15 16 #hasheq((rhombus-type . operator) (type . operator)))
+                (16 17 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
+                (17 18 #hasheq((rhombus-type . operator) (type . operator)))
+                (18 19 #hasheq((rhombus-type . opener) (type . parenthesis)))
+                (19 24 #hasheq((invisible-open-count . 1)
+                               (rhombus-type . identifier)
+                               ;; only newer rhombus lexers supply this:
+                               (semantic-type-guess . keyword)
+                               (type . symbol)))
+                (24 25 #hasheq((rhombus-type . whitespace) (type . 
white-space)))
+                (25 32 #hasheq((invisible-close-count . 1) (rhombus-type . 
identifier) (type . symbol)))
+                (32 33 #hasheq((invisible-close-count . 1) (rhombus-type . 
closer) (type . parenthesis))))))
+     "non-zero backup amounts are used: edit removes block comment")
     (check-equal? (test-update! o 3 16 1 "")
                   '((14 17 #hasheq((invisible-open-count . 1) (rhombus-type . 
at-comment) (type . comment)))
                     (17 18 #hasheq((comment? . #t) (rhombus-type . at-opener) 
(type . parenthesis)))

Reply via email to