Fix ARM etc
This commit is contained in:
40
test/GHCup/Prelude/File/Posix/TraversalsSpec.hs
Normal file
40
test/GHCup/Prelude/File/Posix/TraversalsSpec.hs
Normal file
@@ -0,0 +1,40 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module GHCup.Prelude.File.Posix.TraversalsSpec where
|
||||
|
||||
|
||||
#if !defined(IS_WINDOWS)
|
||||
import GHCup.Prelude.File.Posix.Traversals
|
||||
|
||||
import Control.Monad.IO.Class (liftIO)
|
||||
import Data.List
|
||||
import System.Posix.Directory
|
||||
import Unsafe.Coerce
|
||||
#endif
|
||||
|
||||
import Test.Hspec
|
||||
|
||||
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
#if defined(IS_WINDOWS)
|
||||
pure ()
|
||||
#else
|
||||
-- https://github.com/haskell/ghcup-hs/issues/415
|
||||
describe "GHCup.Prelude.File.Posix.Traversals" $ do
|
||||
it "readDirEnt" $ do
|
||||
dirstream <- liftIO $ openDirStream "test/data"
|
||||
(dt1, fp1) <- readDirEnt dirstream
|
||||
(dt2, fp2) <- readDirEnt dirstream
|
||||
(dt3, fp3) <- readDirEnt dirstream
|
||||
(dt4, fp4) <- readDirEnt dirstream
|
||||
let xs = sortOn snd [ (dt1, fp1), (dt2, fp2)
|
||||
, (dt3, fp3), (dt4, fp4)
|
||||
]
|
||||
xs `shouldBe` [(unsafeCoerce (4 :: Int),".")
|
||||
,(unsafeCoerce (4 :: Int),"..")
|
||||
,(unsafeCoerce (4 :: Int),"dir")
|
||||
,(unsafeCoerce (8 :: Int),"file")
|
||||
]
|
||||
#endif
|
||||
@@ -5,6 +5,7 @@ module GHCup.Types.JSONSpec where
|
||||
import GHCup.ArbitraryTypes ()
|
||||
import GHCup.Types hiding ( defaultSettings )
|
||||
import GHCup.Types.JSON ()
|
||||
import GHCup.Prelude
|
||||
|
||||
import Test.Aeson.GenericSpecs
|
||||
import Test.Hspec
|
||||
@@ -13,5 +14,9 @@ import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
roundtripAndGoldenSpecsWithSettings (defaultSettings { goldenDirectoryOption = CustomDirectoryName "test/golden" }) (Proxy @GHCupInfo)
|
||||
roundtripAndGoldenSpecsWithSettings (defaultSettings { goldenDirectoryOption = CustomDirectoryName goldenDir }) (Proxy @GHCupInfo)
|
||||
where
|
||||
goldenDir
|
||||
| isWindows = "test/golden/windows"
|
||||
| otherwise = "test/golden/unix"
|
||||
|
||||
|
||||
0
test/data/dir/.keep
Normal file
0
test/data/dir/.keep
Normal file
0
test/data/file
Normal file
0
test/data/file
Normal file
16041
test/golden/windows/GHCupInfo.json
Normal file
16041
test/golden/windows/GHCupInfo.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user