diff options
| author | Sibi Prabakaran <sibi@psibi.in> | 2025-06-20 14:59:25 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 14:59:25 +0530 |
| commit | 8cfcdd166b6c34b0eac3bc69b0141678a48db33d (patch) | |
| tree | 92b66dcef473a9ef7fd8d14b208f799d68a0a859 /rust-cargo-tests.el | |
| parent | 0d5d54a19e89f9012f3fa84174f562ab18cebb96 (diff) | |
| parent | f2c0802b3325ca07681e8b5745690127a68cc037 (diff) | |
| download | rust-mode-8cfcdd166b6c34b0eac3bc69b0141678a48db33d.tar.gz | |
Merge pull request #571 from apiraino/rustfmt-2018-edition-default
Ensure rustfmt is invoked without edition parameter
Diffstat (limited to 'rust-cargo-tests.el')
| -rw-r--r-- | rust-cargo-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rust-cargo-tests.el b/rust-cargo-tests.el index fe78ac7..1b072ee 100644 --- a/rust-cargo-tests.el +++ b/rust-cargo-tests.el @@ -21,6 +21,13 @@ (find-file main-file) ,expr))) +(defmacro rust-test--with-snippet-buffer (expr) + `(let* ((test-dir (expand-file-name "test-project/" default-directory)) + (snippet-file (expand-file-name "src/rustfmt-default.rs" test-dir))) + (save-current-buffer + (find-file snippet-file) + ,expr))) + (defun rust-test--find-string (string) "Find STRING in current buffer." (goto-char (point-min)) @@ -70,3 +77,13 @@ (should (eq major-mode 'rust-format-mode)) (should (rust-test--find-string "error:"))) (kill-buffer "*rustfmt*"))) + +(ert-deftest rust-test-respect-rustfmt-defaults () + (skip-unless (executable-find "rustfmt")) + (rust-test--with-snippet-buffer + (let ((old-content (buffer-string)) + (ret (rust-format-buffer))) + (should (string= old-content (buffer-string)))))) + +(ert-deftest rust-test-ensure-rustfmt-switches-nil () + (should (eq rust-rustfmt-switches nil))) |
