diff options
| author | Simeon Simeonov | 2024-11-10 15:15:42 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2024-11-10 15:15:42 +0100 |
| commit | 4227c712db2a11302ec4eda0c5035fecc4e3e4d2 (patch) | |
| tree | a852a6515682594a0c6be6fcfa50755b41f56bea /.emacs.d/lisp/rust-cargo-tests.el | |
| parent | a773e7ed865a1a7eb5bf00b9f0481e888534831a (diff) | |
Upgrade rust-mode and yasnippet
Diffstat (limited to '.emacs.d/lisp/rust-cargo-tests.el')
| -rw-r--r-- | .emacs.d/lisp/rust-cargo-tests.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.emacs.d/lisp/rust-cargo-tests.el b/.emacs.d/lisp/rust-cargo-tests.el index f49cba0..fe78ac7 100644 --- a/.emacs.d/lisp/rust-cargo-tests.el +++ b/.emacs.d/lisp/rust-cargo-tests.el | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; rust-cargo-tests.el --- ERT tests for rust-cargo.el -*- lexical-binding: t; -*- | 1 | ;;; rust-cargo-tests.el --- ERT tests for rust-cargo.el -*- lexical-binding: t; -*- |
| 2 | (require 'rust-cargo) | 2 | (require 'rust-cargo) |
| 3 | (require 'rust-rustfmt) | ||
| 3 | (require 'ert) | 4 | (require 'ert) |
| 4 | 5 | ||
| 5 | (defun rust-test--wait-process-exit () | 6 | (defun rust-test--wait-process-exit () |
| @@ -51,3 +52,21 @@ | |||
| 51 | (rust-test--send-process-string "1234\n") | 52 | (rust-test--send-process-string "1234\n") |
| 52 | (rust-test--wait-process-exit) | 53 | (rust-test--wait-process-exit) |
| 53 | (should (rust-test--find-string "***run interactive: 1234"))))) | 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*"))) | ||
