diff options
| -rw-r--r-- | flymake-clippy-test.el | 37 | ||||
| -rw-r--r-- | test/fixture.txt | 21 |
2 files changed, 19 insertions, 39 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")))) diff --git a/test/fixture.txt b/test/fixture.txt deleted file mode 100644 index 9bbcbea..0000000 --- a/test/fixture.txt +++ /dev/null @@ -1,21 +0,0 @@ -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 - -warning: using `clone` on type `Status` which implements the `Copy` trait - --> src/foo.rs:31:29 - | -31 | Some(status) => status.clone(), - | ^^^^^^^^^^^^^^ help: try dereferencing it: `*status` - -warning: unused variable: `user` - --> src/foobar/user.rs:42:9 - | -42 | user: &User, - | ^^^^ help: if this is intentional, prefix it with an underscore: `_user` - | - = note: `#[warn(unused_variables)]` on by default |
