blob: 0cc30189b9a9917371329c2477887beff315c02b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
;;; flymake-clippy-test.el -*- lexical-binding: t; -*-
(require 'flymake-clippy)
(require 'ert)
(defun run-regexp ()
(set-match-data nil)
(search-forward-regexp (flymake-clippy--build-regexp) nil t)
(list (match-string 1)
(match-string 2)
(match-string 3)))
(ert-deftest clippy-test-regexp ()
"Tests regexp matches diagnostic information."
(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"))))
|