Skip to content

Commit afd143e

Browse files
committed
tests/test-matlab-is-matlab-file.el: add more test cases
1 parent 919ec90 commit afd143e

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed
172 Bytes
Binary file not shown.

tests/test-matlab-is-matlab-file.el

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,33 @@ extract the first *.m file in it and validate it enters a MATLAB mode.
3434
Also, validate `matlab-is-matlab-file' returns t."
3535
(let* ((m-file "test-matlab-is-matlab-file-files/archive.zip")
3636
(zip-buf (get-file-buffer m-file))
37-
m-file-major-mode
38-
is-matlab-file)
37+
(all-entered-a-matlab-mode 'unknown)
38+
(all-are-matlab-file 'unknown))
3939
(when zip-buf
4040
(kill-buffer zip-buf))
4141
(setq zip-buf (find-file-noselect m-file))
4242

4343
(with-current-buffer zip-buf
4444
(goto-char (point-min))
45-
(re-search-forward "\\.m$")
46-
(let ((m-buf (archive-extract)))
47-
(setq m-file-major-mode major-mode)
48-
(setq is-matlab-file (matlab-is-matlab-file))
49-
(kill-buffer m-buf)))
45+
(while (re-search-forward "\\.m$" nil t)
46+
(let ((m-buf (archive-extract))
47+
(is-a-matlab-mode (or (eq major-mode 'matlab-ts-mode)
48+
(eq major-mode 'matlab-mode)))
49+
(is-matlab-file (matlab-is-matlab-file)))
50+
(message "test-matlab-is-matlab-file: checking %s" (buffer-file-name))
51+
(when (or (eq all-entered-a-matlab-mode 'unknown)
52+
(not is-a-matlab-mode))
53+
(setq all-entered-a-matlab-mode is-a-matlab-mode))
54+
55+
(when (or (eq all-are-matlab-file 'unknown)
56+
(not is-matlab-file))
57+
(setq all-are-matlab-file is-matlab-file))
58+
(kill-buffer m-buf)
59+
(set-buffer zip-buf))))
5060

5161
(kill-buffer zip-buf)
52-
(should (or (eq m-file-major-mode 'matlab-ts-mode)
53-
(eq m-file-major-mode 'matlab-mode)))
54-
(should (eq is-matlab-file t))))
62+
(should (eq all-entered-a-matlab-mode t))
63+
(should (eq all-are-matlab-file t))))
5564

5665
(provide 'test-matlab-is-matlab-file)
5766
;;; test-matlab-is-matlab-file.el ends here

0 commit comments

Comments
 (0)