; Add even more tests for previous commit
authorYuan Fu <casouri@gmail.com>
Sun, 15 Sep 2024 07:42:41 +0000 (00:42 -0700)
committerYuan Fu <casouri@gmail.com>
Sun, 15 Sep 2024 07:42:41 +0000 (00:42 -0700)
* test/src/treesit-tests.el:
(treesit-range-fixup-after-edit): Make the tests trickier.

test/src/treesit-tests.el

index 68ed6ca751fd6109a8d04bb238cfc44a10083fb2..6256b1d2fb90aaa3617c95723ec350f96c6508b7 100644 (file)
@@ -711,21 +711,23 @@ visible_end.)"
       (should (equal (treesit-parser-included-ranges parser)
                      '((5 . 7) (10 . 13))))
 
-      ;; Narrow in front.
+      ;; Narrow in front, and discard the last one.
       (widen)
-      (treesit-parser-set-included-ranges parser '((4 . 17)))
+      (treesit-parser-set-included-ranges
+       parser '((4 . 10) (12 . 14) (16 . 20)))
       ;; 11111111111111111111
-      ;;    [           ]
+      ;;    [    ] [  ]  [  ]
       ;; {     } narrow
       (narrow-to-region 1 8)
       (should (equal (treesit-parser-included-ranges parser)
                      '((4 . 8))))
 
-      ;; Narrow in back.
+      ;; Narrow in back, and discard the first one.
       (widen)
-      (treesit-parser-set-included-ranges parser '((4 . 17)))
+      (treesit-parser-set-included-ranges
+       parser '((1 . 5) (7 . 9) (11 . 17)))
       ;; 11111111111111111111
-      ;;    [           ]
+      ;; [  ] [  ]  [    ]
       ;;              {     } narrow
       (narrow-to-region 15 20)
       (should (equal (treesit-parser-included-ranges parser)