From 08788a53251792ea997dc66bb635a72ea14e6946 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferrai Date: Wed, 6 Nov 2019 11:06:28 +0200 Subject: [PATCH] Run the test suite always with UTF8 encoding --- CONTRIBUTING.md | 9 --------- package.yaml | 1 + test/Main.hs | 12 ++++++++++++ test/Spec.hs | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 test/Main.hs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb81002cb..7e43a3e00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,15 +83,6 @@ $ npm install -g bower $ stack test ``` -note: if you receive the following error from running tests: -hGetContents: invalid argument (invalid byte sequence) - -You may be missing an environment variable. try the following - -```bash -$ LC_ALL=en_US.iso88591 -$ stack test -``` ## Merging changes diff --git a/package.yaml b/package.yaml index 6cc0f067d..b8e830558 100644 --- a/package.yaml +++ b/package.yaml @@ -155,6 +155,7 @@ executables: tests: spec: defaults: hspec/hspec@master + main: Main ghc-options: - -threaded - -rtsopts diff --git a/test/Main.hs b/test/Main.hs new file mode 100644 index 000000000..34520747e --- /dev/null +++ b/test/Main.hs @@ -0,0 +1,12 @@ +module Main where + +import Prelude + +import Test.Hspec.Runner +import qualified Spec +import qualified GHC.IO.Encoding + +main :: IO () +main = do + GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8 + hspecWith defaultConfig Spec.spec diff --git a/test/Spec.hs b/test/Spec.hs index a824f8c30..5416ef6a8 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1 +1 @@ -{-# OPTIONS_GHC -F -pgmF hspec-discover #-} +{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}