File: interactive-haskell-mode-tests.el

package info (click to toggle)
haskell-mode 17.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,596 kB
  • sloc: lisp: 21,482; makefile: 104; sh: 59; objc: 13
file content (51 lines) | stat: -rw-r--r-- 2,177 bytes parent folder | download | duplicates (5)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;;; interactive-haskell-mode-tests.el --- Tests for Haskell Interactive Mode  -*- lexical-binding: t -*-

;; Copyright © 2016 Athur Fayzrakhmanov. All rights reserved.

;; This file is part of haskell-mode package.
;; You can contact the authors using GitHub issue tracker:
;; https://github.com/haskell/haskell-mode/issues

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; This package provides regression tests for the package
;; haskell-interactive-mode.

;;; Code:


(require 'ert)
(require 'haskell-interactive-mode)

(defun should-match (str)
  (should (eq 0 (string-match-p haskell-interactive-mode-error-regexp str))))

(ert-deftest haskell-interactive-error-regexp-test ()
  "Tests the regexp `haskell-interactive-mode-error-regexp'"
  (should (eq 0 (string-match-p haskell-interactive-mode-error-regexp
                                "/home/user/Test.hs:24:30:")))
  (should (eq 0 (string-match-p haskell-interactive-mode-error-regexp
                                "Test.hs:5:18:")))
  (should (eq 0 (string-match-p haskell-interactive-mode-error-regexp
                                "Test.hs:7:6: Not in scope: type constructor or class ‘Ty’")))
  (should (eq 0 (string-match-p haskell-interactive-mode-error-regexp
                                "Test.hs:9:5: Not in scope: ‘c’")))
  (should (eq nil (string-match-p haskell-interactive-mode-error-regexp
                                  ;; leading space
                                  " Test.hs:8:9:")))
  )