-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- haskell-goto-next-error - haskell-goto-prev-error - haskell-goto-first-error
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
;;; haskell-load-tests.el | ||
|
||
;;; Code: | ||
|
||
(require 'ert) | ||
(require 'haskell-test-utils) | ||
|
||
(require 'haskell-load) | ||
|
||
(defun insert-errors () | ||
(insert "import Control.Applicativ\nimport Data.Mayb\nimport Data.String") | ||
(goto-char 1) | ||
(let ((applicativ (progn | ||
(search-forward "Control.Applicativ") | ||
(make-overlay (match-beginning 0) (match-end 0))))) | ||
(overlay-put applicativ 'haskell-check t) | ||
(overlay-put applicativ 'haskell-msg-type 'error) | ||
(overlay-put applicativ 'haskell-msg "Could not find module ‘Control.Applicativ’\n Perhaps you meant Control.Applicative (from base-4.8.1.0)\n Use -v to see a list of the files searched for.")) | ||
(let ((mayb (progn | ||
(search-forward "Data.Mayb") | ||
(make-overlay (match-beginning 0) (match-end 0))))) | ||
(overlay-put mayb 'haskell-check t) | ||
(overlay-put mayb 'haskell-msg-type 'error) | ||
(overlay-put mayb 'haskell-msg "Could not find module ‘Data.Mayb’\n Perhaps you meant\n Data.Maybe (from base-4.8.1.0)\n Data.Map (from containers-0.5.6.2@conta_LKCPrTJwOTOLk4OU37YmeN)\n Use -v to see a list of the files searched for.")) | ||
(goto-char 1)) | ||
|
||
(ert-deftest goto-first-error-before () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(haskell-goto-first-error) | ||
(should (looking-at-p "Control.Applicativ")))) | ||
|
||
(ert-deftest goto-first-error-after () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "Data.String") | ||
(haskell-goto-first-error) | ||
(should (looking-at-p "Control.Applicativ")))) | ||
|
||
(ert-deftest goto-first-error-between () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "import Data.Mayb") | ||
(haskell-goto-first-error) | ||
(should (looking-at-p "Control.Applicativ")))) | ||
|
||
(ert-deftest goto-next-error-before () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(haskell-goto-next-error) | ||
(should (looking-at-p "Control.Applicativ")))) | ||
|
||
(ert-deftest goto-next-error-between () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "import" nil nil 2) | ||
(haskell-goto-next-error) | ||
(should (looking-at-p "Data.Mayb")))) | ||
|
||
(ert-deftest goto-next-error-after () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "import" nil nil 3) | ||
(haskell-goto-next-error) | ||
(should (looking-at-p " Data.String")))) | ||
|
||
(ert-deftest goto-prev-error-before () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(haskell-goto-prev-error) | ||
(should (looking-at-p "import Control.Applicativ")))) | ||
|
||
(ert-deftest goto-prev-error-between () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "import" nil nil 2) | ||
(haskell-goto-prev-error) | ||
(should (looking-at-p "Control.Applicativ")))) | ||
|
||
(ert-deftest goto-prev-error-after () | ||
(with-temp-switch-to-buffer | ||
(insert-errors) | ||
(search-forward "import Data.String") | ||
(haskell-goto-prev-error) | ||
(should (looking-at-p "Data.Mayb")))) |