1{-# Language ScopedTypeVariables #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
6import Test.Hspec.QuickCheck(prop)
10import qualified Data.Text as T
11import Data.Maybe (fromJust)
13-- import FileLocation (debug)
15instance Arbitrary T.Text where
16 arbitrary = fmap T.pack arbitrary
24 describe "PathPiece" $ do
25 prop "toPathPiece <=> fromPathPiece String" $ \(p::String) ->
26 case (fromPathPiece . toPathPiece) p of
28 Just pConverted -> p == pConverted
30 prop "toPathPiece <=> fromPathPiece Text" $ \(p::T.Text) ->
31 case (fromPathPiece . toPathPiece) p of
33 Just pConverted -> p == pConverted
35 prop "toPathPiece <=> fromPathPiece Int" $ \(p::Int) ->
36 case (fromPathPiece . toPathPiece) p of
38 Just pConverted -> p == pConverted
40 prop "toPathPiece <=> fromPathPiece Bool" $ \(p::Bool) ->
41 case (fromPathPiece . toPathPiece) p of
43 Just pConverted -> p == pConverted
45 prop "toPathPiece <=> fromPathPiece Maybe String" $ \(p::Maybe String) ->
46 case (fromPathPiece . toPathPiece) p of
48 Just pConverted -> p == pConverted
50 describe "PathMultiPiece" $ do
51 prop "toPathMultiPiece <=> fromPathMultiPiece String" $ \(p::[String]) ->
52 p == (fromJust . fromPathMultiPiece . toPathMultiPiece) p
54 prop "toPathMultiPiece <=> fromPathMultiPiece Text" $ \(p::[T.Text]) ->
55 p == (fromJust . fromPathMultiPiece . toPathMultiPiece) p
58 describe "SinglePiece" $ do
59 prop "toPathPiece <=> fromPathPiece String" $ \(p::String) ->
60 case (fromPathPiece . toPathPiece) p of
62 Just pConverted -> p == pConverted
64 prop "toPathPiece <=> fromPathPiece Text" $ \(p::T.Text) ->
65 case (fromPathPiece . toPathPiece) p of
67 Just pConverted -> p == pConverted
69 prop "toPathPiece <=> fromPathPiece Int" $ \(p::Int) ->
70 case (fromPathPiece . toPathPiece) p of
72 Just pConverted -> p == pConverted
74 describe "MultiPiece" $ do
75 prop "toPathMultiPiece <=> fromPathMultiPiece String" $ \(p::[String]) ->
76 p == (fromJust . fromPathMultiPiece . toPathMultiPiece) p
78 prop "toPathMultiPiece <=> fromPathMultiPiece Text" $ \(p::[T.Text]) ->
79 p == (fromJust . fromPathMultiPiece . toPathMultiPiece) p
81 it "bad ints are rejected" $ fromPathPiece (T.pack "123hello")
82 `shouldBe` (Nothing :: Maybe Int)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list