File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 11; ;; rust-cargo-tests.el --- ERT tests for rust-cargo.el -*- lexical-binding : t ; -*-
22(require 'rust-cargo )
3+ (require 'rust-rustfmt )
34(require 'ert )
45
56(defun rust-test--wait-process-exit ()
5152 (rust-test--send-process-string " 1234\n " )
5253 (rust-test--wait-process-exit)
5354 (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