diff options
Diffstat (limited to 'test/lisp/progmodes/flymake-tests.el')
-rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index 45cabf2efba..71b03b21e5c 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el @@ -23,6 +23,7 @@ ;;; Code: (require 'ert) +(require 'ert-x) (require 'flymake) (eval-when-compile (require 'subr-x)) ; string-trim @@ -123,32 +124,26 @@ SEVERITY-PREDICATE is used to setup "Test the ruby backend." (skip-unless (executable-find "ruby")) ;; Some versions of ruby fail if HOME doesn't exist (bug#29187). - (let* ((tempdir (make-temp-file "flymake-tests-ruby" t)) - (process-environment (cons (format "HOME=%s" tempdir) - process-environment)) - ;; And see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19657#20 - ;; for this particular yuckiness - (abbreviated-home-dir nil)) - (unwind-protect - (let ((ruby-mode-hook - (lambda () - (setq flymake-diagnostic-functions '(ruby-flymake-simple))))) - (flymake-tests--with-flymake ("test.rb") - (flymake-goto-next-error) - (should (eq 'flymake-warning (face-at-point))) - (flymake-goto-next-error) - (should (eq 'flymake-error (face-at-point))))) - (delete-directory tempdir t)))) - -(defun flymake-tests--gcc-is-clang () - "Whether the `gcc' command actually runs the Clang compiler." - (string-match "[Cc]lang version " - (shell-command-to-string "gcc --version"))) + (ert-with-temp-directory tempdir + :suffix "flymake-tests-ruby" + (let* ((process-environment (cons (format "HOME=%s" tempdir) + process-environment)) + ;; And see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19657#20 + ;; for this particular yuckiness + (abbreviated-home-dir nil) + (ruby-mode-hook + (lambda () + (setq flymake-diagnostic-functions '(ruby-flymake-simple))))) + (flymake-tests--with-flymake ("test.rb") + (flymake-goto-next-error) + (should (eq 'flymake-warning (face-at-point))) + (flymake-goto-next-error) + (should (eq 'flymake-error (face-at-point))))))) (ert-deftest different-diagnostic-types () "Test GCC warning via function predicate." (skip-unless (and (executable-find "gcc") - (not (flymake-tests--gcc-is-clang)) + (not (ert-gcc-is-clang-p)) (version<= "5" (string-trim (shell-command-to-string "gcc -dumpversion"))) @@ -173,7 +168,7 @@ SEVERITY-PREDICATE is used to setup (ert-deftest included-c-header-files () "Test inclusion of .h header files." (skip-unless (and (executable-find "gcc") - (not (flymake-tests--gcc-is-clang)) + (not (ert-gcc-is-clang-p)) (executable-find "make"))) (let ((flymake-wrap-around nil)) (flymake-tests--with-flymake |