|
2 | 2 | ;;; Tools for working with Jest tests in Emacs. |
3 | 3 | ;;; |
4 | 4 | ;;; |
5 | | -;;; Copyright (c) 2024 The MathJax Consortium |
| 5 | +;;; Copyright (c) 2024-5 The MathJax Consortium |
6 | 6 |
|
7 | 7 | (require 'ediff) |
| 8 | +(require 'cl-lib) |
8 | 9 |
|
9 | 10 | ;;; Jest Tests |
10 | 11 | ;;; ========== |
|
17 | 18 | ;;; |
18 | 19 |
|
19 | 20 | (defun jest-find-expected () |
20 | | - (block find-fail-block |
| 21 | + (cl-block find-fail-block |
21 | 22 | (let ((expected (condition-case nil |
22 | 23 | (search-forward "Expected value") |
23 | 24 | (error nil)))) |
|
31 | 32 | (defun jest-find-fail () |
32 | 33 | ;; Returns start end for actual and expected and position of fail o/w nil. |
33 | 34 | (interactive) |
34 | | - (block find-fail-block |
| 35 | + (cl-block find-fail-block |
35 | 36 | (let ((pos (condition-case nil |
36 | 37 | (search-forward "●" nil t) |
37 | 38 | (error nil)))) |
38 | 39 | (when (null pos) |
39 | | - (return-from find-fail-block nil)) |
| 40 | + (cl-return-from find-fail-block nil)) |
40 | 41 | (let ((expected (jest-find-expected)) |
41 | 42 | (actual (condition-case nil |
42 | 43 | (search-forward "Received:") |
43 | 44 | (error nil))) |
44 | 45 | ) |
45 | 46 | (when (or (null actual) (null expected)) |
46 | | - (return-from find-fail-block nil)) |
| 47 | + (cl-return-from find-fail-block nil)) |
47 | 48 | (let* ((beg1 (progn |
48 | 49 | (goto-char actual) |
49 | 50 | (search-forward "\"") |
|
88 | 89 | (condition-case nil |
89 | 90 | (search-forward "Summary of all failing tests") |
90 | 91 | (error (beginning-of-buffer))) |
91 | | - (do ((fail (jest-find-fail) (jest-find-fail))) |
| 92 | + (cl-do ((fail (jest-find-fail) (jest-find-fail))) |
92 | 93 | ((null fail) nil) |
93 | 94 | (print fail) |
94 | 95 | (append-to-buffer bufferA (caadr fail) (cdadr fail)) |
|
102 | 103 | ;;; Go to position where you want the next test inserted. |
103 | 104 | (defun jest-replace-expected-for-actual () |
104 | 105 | (interactive) |
105 | | - (block expected-block |
| 106 | + (cl-block expected-block |
106 | 107 | (other-window 1) |
107 | 108 | (let* ((fail (jest-find-fail)) |
108 | 109 | (actual (car (fourth fail))) |
|
0 commit comments