Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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 Source #
Representation of a VirtualFileTree
that has been materialise
d to disk.
Instances
Show FileSystem Source # | |
Defined in Test.Hls.FileSystem showsPrec :: Int -> FileSystem -> ShowS # show :: FileSystem -> String # showList :: [FileSystem] -> ShowS # | |
Eq FileSystem Source # | |
Defined in Test.Hls.FileSystem (==) :: FileSystem -> FileSystem -> Bool # (/=) :: FileSystem -> FileSystem -> Bool # | |
Ord FileSystem Source # | |
Defined in Test.Hls.FileSystem 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 Source #
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
.
Instances
Show VirtualFileTree Source # | |
Defined in Test.Hls.FileSystem showsPrec :: Int -> VirtualFileTree -> ShowS # show :: VirtualFileTree -> String # showList :: [VirtualFileTree] -> ShowS # | |
Eq VirtualFileTree Source # | |
Defined in Test.Hls.FileSystem (==) :: VirtualFileTree -> VirtualFileTree -> Bool # (/=) :: VirtualFileTree -> VirtualFileTree -> Bool # | |
Ord VirtualFileTree Source # | |
Defined in Test.Hls.FileSystem 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 Source #
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 Source #
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 Source #
writeFileFS :: FileSystem -> FilePath -> Content -> IO () Source #
Test helpers
mkVirtualFileTree :: FilePath -> [FileTree] -> VirtualFileTree Source #
toNfp :: FileSystem -> FilePath -> NormalizedFilePath Source #
Builders
file :: FilePath -> Content -> FileTree Source #
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 Source #
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.
ref :: FilePath -> Content Source #
Read the contents of the given file The filepath is always resolved to the root of the test data dir.
copyDir :: FilePath -> FileTree Source #
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 Source #
Set up a simple direct cradle.
All arguments are added to the direct cradle file. Arguments will not be escaped.
simpleCabalCradle :: FileTree Source #
Set up a simple cabal cradle.
Prefer simple cabal cradle, over custom multi cabal cradles if possible.
Full project setups
directProject :: FilePath -> [FileTree] Source #
Set up a test project with a single haskell file.
directProjectMulti :: [FilePath] -> [FileTree] Source #
Set up a test project with multiple haskell files.
simpleCabalProject :: [FilePath] -> [FileTree] Source #
Set up a simple cabal cradle project and copy all the given filepaths into the test directory.
simpleCabalProject' :: [FileTree] -> [FileTree] Source #
Set up a simple cabal cradle project.