| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Test.Hls.FileSystem
Synopsis
- data FileSystem = FileSystem {}
- data VirtualFileTree = VirtualFileTree {
- vftTree :: [FileTree]
- vftOriginalRoot :: FilePath
- data FileTree
- data Content
- materialise :: FilePath -> [FileTree] -> FilePath -> IO FileSystem
- materialiseVFT :: FilePath -> VirtualFileTree -> IO FileSystem
- readFileFS :: FileSystem -> FilePath -> IO Text
- writeFileFS :: FileSystem -> FilePath -> Content -> IO ()
- mkVirtualFileTree :: FilePath -> [FileTree] -> VirtualFileTree
- toNfp :: FileSystem -> FilePath -> NormalizedFilePath
- toAbsFp :: FileSystem -> FilePath -> FilePath
- file :: FilePath -> Content -> FileTree
- copy :: FilePath -> FileTree
- directory :: FilePath -> [FileTree] -> FileTree
- text :: Text -> Content
- ref :: FilePath -> Content
- copyDir :: FilePath -> FileTree
- directCradle :: [Text] -> FileTree
- simpleCabalCradle :: FileTree
- directProject :: FilePath -> [FileTree]
- directProjectMulti :: [FilePath] -> [FileTree]
- simpleCabalProject :: [FilePath] -> [FileTree]
- simpleCabalProject' :: [FileTree] -> [FileTree]
Documentation
data FileSystem #
Representation of a VirtualFileTree that has been materialised to disk.
Constructors
| FileSystem | |
Instances
| Show FileSystem # | |
Defined in Test.Hls.FileSystem Methods showsPrec :: Int -> FileSystem -> ShowS # show :: FileSystem -> String # showList :: [FileSystem] -> ShowS # | |
| Eq FileSystem # | |
Defined in Test.Hls.FileSystem | |
| Ord FileSystem # | |
Defined in Test.Hls.FileSystem Methods compare :: FileSystem -> FileSystem -> Ordering # (<) :: FileSystem -> FileSystem -> Bool # (<=) :: FileSystem -> FileSystem -> Bool # (>) :: FileSystem -> FileSystem -> Bool # (>=) :: FileSystem -> FileSystem -> Bool # max :: FileSystem -> FileSystem -> FileSystem # min :: FileSystem -> FileSystem -> FileSystem # | |
data VirtualFileTree #
Virtual representation of a filesystem tree.
Operations of vftTree are relative to vftOriginalRoot.
In particular, any copy etc. operation looks for the sources in vftOriginalRoot.
To persist a VirtualFileTree, look at materialise and materialiseVFT.
Constructors
| VirtualFileTree | |
Fields
| |
Instances
| Show VirtualFileTree # | |
Defined in Test.Hls.FileSystem Methods showsPrec :: Int -> VirtualFileTree -> ShowS # show :: VirtualFileTree -> String # showList :: [VirtualFileTree] -> ShowS # | |
| Eq VirtualFileTree # | |
Defined in Test.Hls.FileSystem Methods (==) :: VirtualFileTree -> VirtualFileTree -> Bool # (/=) :: VirtualFileTree -> VirtualFileTree -> Bool # | |
| Ord VirtualFileTree # | |
Defined in Test.Hls.FileSystem Methods compare :: VirtualFileTree -> VirtualFileTree -> Ordering # (<) :: VirtualFileTree -> VirtualFileTree -> Bool # (<=) :: VirtualFileTree -> VirtualFileTree -> Bool # (>) :: VirtualFileTree -> VirtualFileTree -> Bool # (>=) :: VirtualFileTree -> VirtualFileTree -> Bool # max :: VirtualFileTree -> VirtualFileTree -> VirtualFileTree # min :: VirtualFileTree -> VirtualFileTree -> VirtualFileTree # | |
init
materialise :: FilePath -> [FileTree] -> FilePath -> IO FileSystem #
Materialise a virtual file tree in the rootDir directory.
Synopsis: materialise rootDir fileTree testDataDir
File references in '[FileTree]' are resolved relative to the testDataDir.
materialiseVFT :: FilePath -> VirtualFileTree -> IO FileSystem #
Materialise a virtual file tree in the rootDir directory.
Synopsis: materialiseVFT rootDir virtualFileTree
File references in virtualFileTree are resolved relative to the vftOriginalRoot.
Interaction
readFileFS :: FileSystem -> FilePath -> IO Text #
writeFileFS :: FileSystem -> FilePath -> Content -> IO () #
Test helpers
mkVirtualFileTree :: FilePath -> [FileTree] -> VirtualFileTree #
toNfp :: FileSystem -> FilePath -> NormalizedFilePath #
toAbsFp :: FileSystem -> FilePath -> FilePath #
Builders
file :: FilePath -> Content -> FileTree #
Create a file in the test project with some content.
Only the filename will be used, and any directory components are *not* reflected in the test project.
copy :: FilePath -> FileTree #
Copy a filepath into a test project. The name of the file is also used in the test project.
The filepath is always resolved to the root of the test data dir.
Read the contents of the given file The filepath is always resolved to the root of the test data dir.
copyDir :: FilePath -> FileTree #
Copy a directory into a test project. The filepath is always resolved to the root of the test data dir.
Cradle helpers
directCradle :: [Text] -> FileTree #
Set up a simple direct cradle.
All arguments are added to the direct cradle file. Arguments will not be escaped.
simpleCabalCradle :: FileTree #
Set up a simple cabal cradle.
Prefer simple cabal cradle, over custom multi cabal cradles if possible.
Full project setups
directProject :: FilePath -> [FileTree] #
Set up a test project with a single haskell file.
directProjectMulti :: [FilePath] -> [FileTree] #
Set up a test project with multiple haskell files.
simpleCabalProject :: [FilePath] -> [FileTree] #
Set up a simple cabal cradle project and copy all the given filepaths into the test directory.
simpleCabalProject' :: [FileTree] -> [FileTree] #
Set up a simple cabal cradle project.