@@ -20,21 +20,28 @@ import System.IO
2020 , hClose
2121 , hFlush
2222 , hSeek
23- , openFile
23+ , hPutStr
2424 )
2525import System.IO.Temp (withSystemTempDirectory )
26+ import Streamly.Internal.FileSystem.File.Utils (openFile , withFile )
2627import Test.QuickCheck (Property , forAll , Gen , vectorOf , choose )
2728import Test.QuickCheck.Monadic (monadicIO , assert , run )
29+ import Streamly.Internal.FileSystem.Path (Path )
2830
2931import qualified Streamly.Data.Fold as Fold
3032import qualified Streamly.Internal.FileSystem.Handle as Handle
3133import qualified Streamly.Internal.Data.Stream as Stream
3234import qualified Streamly.Internal.Data.Array as Array
3335import qualified Streamly.Internal.Unicode.Stream as Unicode
36+ import qualified Streamly.Internal.FileSystem.Path as Path
3437
38+ import Prelude hiding (writeFile )
3539import Test.Hspec as H
3640import Test.Hspec.QuickCheck
3741
42+ writeFile :: Path -> String -> IO ()
43+ writeFile fpath val = withFile fpath WriteMode (flip hPutStr val)
44+
3845maxArrLen :: Int
3946maxArrLen = defaultChunkSize * 8
4047
@@ -63,7 +70,7 @@ testBinData = "01234567890123456789012345678901234567890123456789"
6370executor :: (Handle -> Stream IO Char ) -> IO (Stream IO Char )
6471executor f =
6572 withSystemTempDirectory " fs_handle" $ \ fp -> do
66- let fpath = fp </> " tmp_read.txt"
73+ fpath <- Path. fromString $ fp </> " tmp_read.txt"
6774 writeFile fpath testDataLarge
6875 h <- openFile fpath ReadMode
6976 return $ f h
@@ -115,7 +122,7 @@ testWrite hfold =
115122
116123 go list =
117124 withSystemTempDirectory " fs_handle" $ \ fp -> do
118- let fpathWrite = fp </> " tmp_write.txt"
125+ fpathWrite <- Path. fromString $ fp </> " tmp_write.txt"
119126 writeFile fpathWrite " "
120127 h <- openFile fpathWrite ReadWriteMode
121128 hSeek h AbsoluteSeek 0
@@ -136,8 +143,8 @@ testWriteWithChunk =
136143
137144 go =
138145 withSystemTempDirectory " fs_handle" $ \ fp -> do
139- let fpathRead = fp </> " tmp_read.txt"
140- fpathWrite = fp </> " tmp_write.txt"
146+ fpathRead <- Path. fromString $ fp </> " tmp_read.txt"
147+ fpathWrite <- Path. fromString $ fp </> " tmp_write.txt"
141148 writeFile fpathRead testDataLarge
142149 writeFile fpathWrite " "
143150 hr <- openFile fpathRead ReadMode
@@ -158,7 +165,7 @@ testReadChunksFromToWith from to buffSize res = monadicIO $ run go
158165
159166 go =
160167 withSystemTempDirectory " fs_handle" $ \ fp -> do
161- let fpathRead = fp </> " tmp_read.txt"
168+ fpathRead <- Path. fromString $ fp </> " tmp_read.txt"
162169 writeFile fpathRead testBinData
163170 h <- openFile fpathRead ReadMode
164171 ls <-
0 commit comments