mirror of
https://github.com/serokell/haskell-with-utf8.git
synced 2024-09-11 06:45:36 +03:00
The old interface only allowed one to perform terminal detection on a handle and change it to UTF-8 if it was not a terminal. Turns our, it makes sense to sometimes leave the original encoding on a handle even if it does not point to a terminal. * Change the interface to separate these two use-cases. * Extract main-wrappers to a new `Main` module.
23 lines
579 B
Haskell
23 lines
579 B
Haskell
{- SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
|
|
-
|
|
- SPDX-License-Identifier: MPL-2.0
|
|
-}
|
|
|
|
module Main
|
|
( main
|
|
) where
|
|
|
|
import GHC.IO.Encoding (mkTextEncoding, setLocaleEncoding)
|
|
import Main.Utf8 (withUtf8)
|
|
import Test.Tasty (defaultMain)
|
|
|
|
import Tree (tests)
|
|
|
|
main :: IO ()
|
|
main = withUtf8 $ do
|
|
-- The issue only shows up when current locale encoding is ASCII.
|
|
-- Realistically, very often when running this test this will not be
|
|
-- the case, so we unset locale encoding manually.
|
|
mkTextEncoding "ASCII" >>= setLocaleEncoding
|
|
tests >>= defaultMain
|