diff options
Diffstat (limited to 'flymake-clippy-test.el')
| -rw-r--r-- | flymake-clippy-test.el | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/flymake-clippy-test.el b/flymake-clippy-test.el index 9f2c527..f58b303 100644 --- a/flymake-clippy-test.el +++ b/flymake-clippy-test.el @@ -16,24 +16,6 @@ (match-string 2) (match-string 3))) -(ert-deftest clippy-test-fixture () - "Tests fixture diagnostics." - (should (equal (with-temp-buffer - (insert-file-contents "./test/fixture.txt") - (run-regexp)) - '("warning: unused variable: `user`" "src/database/foo.rs" "42"))) - (should (equal (with-temp-buffer - (insert-file-contents "./test/fixture.txt") - (run-regexp) - (run-regexp)) - '("warning: using `clone` on type `Status` which implements the `Copy` trait" "src/foo.rs" "31"))) - (should (equal (with-temp-buffer - (insert-file-contents "./test/fixture.txt") - (run-regexp) - (run-regexp) - (run-regexp)) - '("warning: unused variable: `user`" "src/foobar/user.rs" "42")))) - (defvar warning-text "warning: unused variable: `user` --> src/database/foo.rs:42:9 @@ -62,3 +44,22 @@ '("error: expected one of `!` or `::`, found foobar" "src/main.rs" "20"))) (should (equal (with-text error-text-with-error-num (run-regexp)) '("error[E0407]: method `build_string` is not defined" "src/features.rs" "106")))) + +(defvar multiline-text +"warning: unused variable: `user` + --> src/database/foo.rs:42:9 + | +42 | user: &User, + | ^^^^ help: if this is intentional, prefix it with an underscore: `_user` + | + = note: `#[warn(unused_variables)]` on by default + +error: expected one of `!` or `::`, found foobar + --> src/main.rs:20:9") + +(ert-deftest clippy-test-multiline () + "Tests consecutive `run-regexp' calls." + (should (equal (with-text multiline-text (run-regexp)) + '("warning: unused variable: `user`" "src/database/foo.rs" "42"))) + (should (equal (with-text multiline-text (run-regexp) (run-regexp)) + '("error: expected one of `!` or `::`, found foobar" "src/main.rs" "20")))) |
