Skip to content

Commit 946d072

Browse files
committed
Try fixing the tests.
1 parent 38a5002 commit 946d072

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

Cask

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"get-cabal-configuration.hs")
99

1010
(development
11-
(depends-on "cl-lib"))
11+
(depends-on "cl-lib" "dash"))

test/flycheck-haskell-test.el

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
(require 'flycheck-haskell)
2929

3030
(require 'cl-lib)
31+
(require 'dash)
3132
(require 'ert)
3233

3334

@@ -54,6 +55,10 @@
5455
`(unwind-protect (progn ,@body)
5556
(flycheck-haskell-clear-config-cache)))
5657

58+
(defun flycheck-haskell-compare-sets (actual expected)
59+
"Compare ACTUAL and EXPECTED ignoring ordering."
60+
(should (equal '() (-difference actual expected))))
61+
5762

5863
;;; Test cases
5964

@@ -98,33 +103,33 @@
98103
(should (= (hash-table-count flycheck-haskell-config-cache) 0))))
99104

100105
(ert-deftest flycheck-haskell-read-cabal-configuration/has-all-extensions ()
101-
(should (equal (assq 'extensions (flycheck-haskell-read-test-config))
102-
'(extensions "OverloadedStrings"
103-
"YouDontKnowThisOne"
104-
"GeneralizedNewtypeDeriving"))))
106+
(flycheck-haskell-compare-sets (assq 'extensions (flycheck-haskell-read-test-config))
107+
'(extensions "OverloadedStrings"
108+
"YouDontKnowThisOne"
109+
"GeneralizedNewtypeDeriving")))
105110

106111
(ert-deftest flycheck-haskell-read-cabal-configuration/has-all-languages ()
107-
(should (equal (assq 'languages (flycheck-haskell-read-test-config))
108-
'(languages "Haskell98" "SpamLanguage" "Haskell2010"))))
112+
(flycheck-haskell-compare-sets (assq 'languages (flycheck-haskell-read-test-config))
113+
'(languages "Haskell98" "SpamLanguage" "Haskell2010")))
109114

110115
(ert-deftest flycheck-haskell-read-cabal-configuration/source-dirs ()
111116
(let* ((builddirs '("lib/" "." "src/"))
112117
(expanddir (lambda (fn)
113118
(file-name-as-directory
114119
(expand-file-name fn flycheck-haskell-test-dir)))))
115-
(should (equal
116-
(assq 'source-directories (flycheck-haskell-read-test-config))
117-
(cons 'source-directories (-map expanddir builddirs))))))
120+
(flycheck-haskell-compare-sets
121+
(assq 'source-directories (flycheck-haskell-read-test-config))
122+
(cons 'source-directories (-map expanddir builddirs)))))
118123

119124
(ert-deftest flycheck-haskell-read-cabal-configuration/build-dirs ()
120125
(let* ((distdir (expand-file-name "dist/" flycheck-haskell-test-dir))
121126
(expanddir (lambda (fn) (expand-file-name fn distdir)))
122127
(builddirs '("build" "build/autogen"
123128
"build/flycheck-haskell-unknown-stuff/flycheck-haskell-unknown-stuff-tmp"
124129
"build/flycheck-haskell-test/flycheck-haskell-test-tmp")))
125-
(should (equal
126-
(assq 'build-directories (flycheck-haskell-read-test-config))
127-
(cons 'build-directories (-map expanddir builddirs))))))
130+
(flycheck-haskell-compare-sets
131+
(assq 'build-directories (flycheck-haskell-read-test-config))
132+
(cons 'build-directories (-map expanddir builddirs)))))
128133

129134
(ert-deftest flycheck-haskell-get-configuration/no-cache-entry ()
130135
(let* ((cabal-file flycheck-haskell-test-cabal-file))
@@ -156,13 +161,14 @@
156161
(ert-deftest flycheck-haskell-process-configuration/language-extensions ()
157162
(with-temp-buffer ; To scope the variables
158163
(flycheck-haskell-process-configuration (flycheck-haskell-read-test-config))
159-
(should (equal flycheck-ghc-language-extensions
160-
'("OverloadedStrings"
161-
"YouDontKnowThisOne"
162-
"GeneralizedNewtypeDeriving"
163-
"Haskell98"
164-
"SpamLanguage"
165-
"Haskell2010")))
164+
(flycheck-haskell-compare-sets
165+
flycheck-ghc-language-extensions
166+
'("OverloadedStrings"
167+
"YouDontKnowThisOne"
168+
"GeneralizedNewtypeDeriving"
169+
"Haskell98"
170+
"SpamLanguage"
171+
"Haskell2010"))
166172
(should (local-variable-p 'flycheck-ghc-language-extensions))))
167173

168174
(ert-deftest flycheck-haskell-process-configuration/search-path ()
@@ -173,12 +179,12 @@
173179
"build/flycheck-haskell-test/flycheck-haskell-test-tmp"))
174180
(sourcedir (lambda (fn) (file-name-as-directory
175181
(expand-file-name fn flycheck-haskell-test-dir))))
176-
(sourcedirs '("lib/" "." "src/")))
182+
(sourcedirs '("lib/" "." "src/"))
183+
(computed-path (append (-map builddir builddirs)
184+
(-map sourcedir sourcedirs))))
177185
(with-temp-buffer
178186
(flycheck-haskell-process-configuration (flycheck-haskell-read-test-config))
179-
(should (equal flycheck-ghc-search-path
180-
(append (-map builddir builddirs)
181-
(-map sourcedir sourcedirs))))
187+
(flycheck-haskell-compare-sets flycheck-ghc-search-path computed-path)
182188
(should (local-variable-p 'flycheck-ghc-search-path)))))
183189

184190
(provide 'flycheck-haskell-test)

0 commit comments

Comments
 (0)