|
131 | 131 | ;; */ |
132 | 132 | ;; |
133 | 133 | ;; To create a test that contains a number of tests cases (*.lang files), you write a test |
134 | | -;; driver, say test-LANGAGE-ts-mode-indent-xr that invokes `t-utils-test-xr'. |
| 134 | +;; driver, say test-LANGUAGE-ts-mode-indent-xr that invokes `t-utils-test-xr'. |
135 | 135 | ;; |
136 | 136 | ;; 5. Sweep tests |
137 | 137 | ;; |
@@ -2463,12 +2463,28 @@ each element is a cons pair (NAME . NODE)." |
2463 | 2463 | (end-col (save-excursion |
2464 | 2464 | (goto-char end-point) |
2465 | 2465 | (1+ (current-column))))) |
2466 | | - (push (format "%s node at line %d:%d to %d:%d (point %d to %d)" |
| 2466 | + (push (format "%s node at line %d:%d to %d:%d (point %d to %d) |
| 2467 | +%5d | %s |
| 2468 | + | %s^ |
| 2469 | +" |
2467 | 2470 | (treesit-node-type error-node) |
2468 | 2471 | start-line start-col |
2469 | 2472 | end-line end-col |
2470 | 2473 | start-point |
2471 | | - end-point) |
| 2474 | + end-point |
| 2475 | + start-line |
| 2476 | + ;; error line |
| 2477 | + (buffer-substring (save-excursion |
| 2478 | + (goto-char start-point) |
| 2479 | + (line-beginning-position)) |
| 2480 | + (save-excursion |
| 2481 | + (goto-char start-point) |
| 2482 | + (line-end-position))) |
| 2483 | + ;; space padding for the pointer (^) |
| 2484 | + (save-excursion |
| 2485 | + (goto-char start-point) |
| 2486 | + (let ((n-spaces (- start-point (line-beginning-position)))) |
| 2487 | + (make-string n-spaces ? )))) |
2472 | 2488 | result-list))) |
2473 | 2489 | (reverse result-list))) |
2474 | 2490 |
|
@@ -2636,7 +2652,7 @@ Similar `treesit--explorer-draw-node' but designed for test baselines." |
2636 | 2652 | ;; Consider foo.m containing: |
2637 | 2653 | ;; foo.out1 |
2638 | 2654 | ;; If we use (field-name (treesit-node-field-name node)) we get different answers |
2639 | | - ;; dependening on the version of libtree-sitter.so or .dll. Adding in the let below |
| 2655 | + ;; depending on the version of libtree-sitter.so or .dll. Adding in the let below |
2640 | 2656 | ;; (message "\ |
2641 | 2657 | ;; node: %S |
2642 | 2658 | ;; field-name: %S |
@@ -2910,7 +2926,7 @@ To debug a specific -parser test file |
2910 | 2926 | (provide 't-utils) |
2911 | 2927 | ;;; t-utils.el ends here |
2912 | 2928 |
|
2913 | | -;; LocalWords: lang defun alist eos treesit lf setq truename dolist nondirectory bos buf funcall |
| 2929 | +;; LocalWords: lang defun alist eos treesit lf setq truename dolist nondirectory bos buf funcall nt |
2914 | 2930 | ;; LocalWords: consp listp cdr CRLF impl tmp xr boundp SPC kbd prin progn defmacro sexp stdlib locs |
2915 | 2931 | ;; LocalWords: showall repeat:nil kkk fff Dkkkk kkkkkk mapcar eobp trim'd bol NPS prev puthash |
2916 | | -;; LocalWords: maphash lessp gethash nbutlast mapconcat ppss imenu pcase eow NAME's |
| 2932 | +;; LocalWords: maphash lessp gethash nbutlast mapconcat ppss imenu pcase eow NAME's darwin libtree |
0 commit comments