-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13391cf
commit 88adcb3
Showing
7 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module FileUtilSpec where | ||
|
||
import Data.List ( isPrefixOf ) | ||
import FileUtil | ||
import System.Directory ( getHomeDirectory ) | ||
import Test.Hspec | ||
import Test.Hspec.QuickCheck ( prop ) | ||
import Test.QuickCheck | ||
|
||
genStringStartWithTilde :: Gen String | ||
genStringStartWithTilde = fmap ("~/" ++) arbitrary | ||
|
||
spec :: Spec | ||
spec = | ||
describe "absolutize" $ do | ||
it "Root path should be expanded to root" $ do | ||
actual <- absolutize "/" | ||
actual `shouldBe` "/" | ||
|
||
it "Home path should be expanded to home" $ do | ||
homePath <- getHomeDirectory | ||
actual <- absolutize "~" | ||
actual `shouldBe` (homePath ++ "/") | ||
|
||
prop "~/**/** should be expanded to home" $ forAll genStringStartWithTilde $ \path -> do | ||
homePath <- getHomeDirectory | ||
absolutizedPath <- absolutize path | ||
(homePath `isPrefixOf` absolutizedPath) `shouldBe` True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
{-# OPTIONS_GHC -F -pgmF hspec-discover #-} | ||
|
||
main :: IO () | ||
main = putStrLn "Test suite not yet implemented" | ||
main = putStrLn "" |