;; The ERT test suite encodes expected output for a large number of
;; command line tools, so the test suite is fragile and breaks when a
;; new version of one these tools is uploaded to Debian.

;; To avoid essentially spurious FTBFS failures due to this fragility,
;; we skip the ERT tests at package build time.  We still run the more
;; robust Buttercup tests.

;; We run the ERT tests & Buttercup tests with autopkgtest.

(when (or (getenv "ADT_TMP") (getenv "AUTOPKGTEST_TMP"))
  (load-library "haskell-mode-autoloads")
  (load-file "test/run.el")

  ;; stack will fail if $HOME is not a writable directory, and the
  ;; autopkgtest specification does not guarantee that it is.  So tell
  ;; stack to work somewhere else
  (setenv "STACK_ROOT" (or (getenv "AUTOPKGTEST_TMP")
                           (getenv "ADT_TMP")))

  (flycheck-run-tests-main))
