File: haskell-customize-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 (74 lines) | stat: -rw-r--r-- 2,667 bytes parent folder | download | duplicates (3)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; haskell-customize.el --- Customization settings -*- lexical-binding: t -*-

;; Copyright (c) 2014 Vasantha Ganesh Kanniappan <vasanthaganesh.k@tuta.io>

;; 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 this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Code:

(require 'ert)
(require 'haskell-customize)
(require 'haskell-test-utils)

(defvar dir-structure nil)

(ert-deftest haskell-process-type-test-1 ()
  (with-temp-dir-structure
   (("README.md" . "Hello world")
    ("Main.hs" . "-- Empty file")
    ("abc.cabal" . "-- Empty File")
    ("stack.yaml" . "# Empty file")
    ("src" . (("moduleA.hs" . "-- Empty file")
              ("moduleB.hs" . "-- Empty file")))
    ("tests" . (("test1.hs" . "-- Empty file")
                ("test2.hs" . "-- Empty file"))))
   (progn
     (cd "tests")
     (should (eq 'stack-ghci (haskell-process-type))))))

(ert-deftest haskell-process-type-test-2 ()
  (with-temp-dir-structure
   (("README.md" . "Hello world")
    ("Main.hs" . "-- Empty file")
    ("stack.yaml" . "# Empty file")
    ("src" . (("moduleA.hs" . "-- Empty file")
                 ("moduleB.hs" . "-- Empty file")))
    ("tests" . (("test1.hs" . "-- Empty file")
                ("test2.hs" . "-- Empty file"))))
   (progn
     (cd "src")
     (should (eq 'stack-ghci (haskell-process-type))))))

(ert-deftest haskell-process-type-test-3 ()
  (with-temp-dir-structure
   (("README.md" . "Hello world")
    ("Main.hs" . "-- Empty file")
    ("abc.cabal" . "-- Empty file")
    ("src" . (("moduleA.hs" . "-- Empty file")
              ("moduleB.hs" . "-- Empty file")))
    ("tests" . (("test1.hs" . "-- Empty file")
                ("test2.hs" . "-- Empty file"))))
   (progn
     (should (eq 'cabal-repl (haskell-process-type))))))

(ert-deftest haskell-process-type-test-4 ()
  (with-temp-dir-structure
   (("README.md" . "Hello world")
    ("Main.hs" . "-- Empty file")
    ("src" . (("moduleA.hs" . "-- Empty file")
              ("moduleB.hs" . "-- Empty file")))
    ("tests" . (("test1.hs" . "-- Empty file")
                ("test2.hs" . "-- Empty file"))))
   (progn
     (should (eq 'ghci (haskell-process-type))))))