File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
; ;; rust-cargo-tests.el --- ERT tests for rust-cargo.el -*- lexical-binding : t ; -*-
2
2
(require 'rust-cargo )
3
+ (require 'rust-rustfmt )
3
4
(require 'ert )
4
5
5
6
(defun rust-test--wait-process-exit ()
51
52
(rust-test--send-process-string " 1234\n " )
52
53
(rust-test--wait-process-exit)
53
54
(should (rust-test--find-string " ***run interactive: 1234" )))))
55
+
56
+ (ert-deftest rust-test-rustfmt ()
57
+ (skip-unless (executable-find " rustfmt" ))
58
+ (rust-test--with-main-file-buffer
59
+ (let ((old-content (buffer-string ))
60
+ (ret (rust-format-buffer)))
61
+ (should (string= ret " Formatted buffer with rustfmt." ))
62
+ (should (string= old-content (buffer-string ))))))
63
+
64
+ (ert-deftest rust-test-rustfmt-parsing-errors ()
65
+ (skip-unless (executable-find " rustfmt" ))
66
+ (with-temp-buffer
67
+ (insert " fn main() {" )
68
+ (rust-format-buffer)
69
+ (with-current-buffer " *rustfmt*"
70
+ (should (eq major-mode 'rust-format-mode ))
71
+ (should (rust-test--find-string " error:" )))
72
+ (kill-buffer " *rustfmt*" )))
You can’t perform that action at this time.
0 commit comments