githud 2.0.2 → 2.1.0
raw patch · 5 files changed
+442/−86 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ GitHUD.Terminal.Types: NONE :: Shell
+ GitHUD.Terminal.Types: TMUX :: Shell
Files
- githud.cabal +1/−1
- src/GitHUD.hs +2/−0
- src/GitHUD/Terminal/Base.hs +32/−4
- src/GitHUD/Terminal/Types.hs +1/−1
- test/Test/GitHUD/Terminal/Prompt.hs +406/−80
githud.cabal view
@@ -1,5 +1,5 @@ name: githud-version: 2.0.2+version: 2.1.0 synopsis: More efficient replacement to the great git-radar description: Please see README.md (used to be gitHUD) homepage: http://github.com/gbataille/gitHUD#readme
src/GitHUD.hs view
@@ -42,6 +42,8 @@ -> Shell getShell ("zsh":_) = ZSH getShell ("bash":_) = BASH+getShell ("tmux":_) = TMUX+getShell ("none":_) = NONE getShell _ = Other getAppConfig :: IO Config
src/GitHUD/Terminal/Base.hs view
@@ -25,13 +25,17 @@ -> ColorIntensity -> Shell -> String-startColorMarker color intensity shell =- applyShellMarkers shell $ terminalStartCode color intensity+startColorMarker color intensity shell+ | shell == TMUX = tmuxStartCode color intensity+ | shell == NONE = ""+ | otherwise = applyShellMarkers shell $ terminalStartCode color intensity endColorMarker :: Shell -> String-endColorMarker shell =- applyShellMarkers shell $ terminalEndCode+endColorMarker shell+ | shell == TMUX = tmuxEndCode+ | shell == NONE = ""+ | otherwise = applyShellMarkers shell $ terminalEndCode applyShellMarkers :: Shell -> String@@ -71,3 +75,27 @@ terminalEndCode :: String terminalEndCode = "\x1b[0;39m"++tmuxStartCode :: Color+ -> ColorIntensity+ -> String+tmuxStartCode Black Vivid = "#[fg=brightblack]"+tmuxStartCode Red Vivid = "#[fg=brightred]"+tmuxStartCode Green Vivid = "#[fg=brightgreen]"+tmuxStartCode Yellow Vivid = "#[fg=brightyellow]"+tmuxStartCode Blue Vivid = "#[fg=brightblue]"+tmuxStartCode Magenta Vivid = "#[fg=brightmagenta]"+tmuxStartCode Cyan Vivid = "#[fg=brightcyan]"+tmuxStartCode White Vivid = "#[fg=brightwhite]"+tmuxStartCode Black Dull = "#[fg=black]"+tmuxStartCode Red Dull = "#[fg=red]"+tmuxStartCode Green Dull = "#[fg=green]"+tmuxStartCode Yellow Dull = "#[fg=yellow]"+tmuxStartCode Blue Dull = "#[fg=blue]"+tmuxStartCode Magenta Dull = "#[fg=magenta]"+tmuxStartCode Cyan Dull = "#[fg=cyan]"+tmuxStartCode White Dull = "#[fg=white]"+tmuxStartCode NoColor _ = tmuxEndCode++tmuxEndCode :: String+tmuxEndCode = "#[fg=default]"
src/GitHUD/Terminal/Types.hs view
@@ -6,4 +6,4 @@ data Color = Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | NoColor deriving (Eq, Show, Read) data ColorIntensity = Dull | Vivid deriving (Eq, Show, Read)-data Shell = ZSH | BASH | Other deriving (Eq, Show)+data Shell = ZSH | BASH | TMUX | NONE | Other deriving (Eq, Show)
test/Test/GitHUD/Terminal/Prompt.hs view
@@ -14,6 +14,9 @@ import GitHUD.Terminal.Types import GitHUD.Types +allPrompts :: [Shell]+allPrompts = [ZSH, BASH, TMUX, NONE, Other]+ terminalPromptTests :: TestTree terminalPromptTests = testGroup "Terminal Prompt Test" [ testResetPromptAtBeginning@@ -29,34 +32,33 @@ testResetPromptAtBeginning :: TestTree testResetPromptAtBeginning = testGroup "#resetPromptAtBeginning"- [ testCase "Should start the prompt with a reset color control sequence" $+ [ testCase "ZSH: Should start the prompt with a reset color control sequence" $ testWriterWithConfig (zeroOutputConfig ZSH) resetPromptAtBeginning @?= "%{\x1b[0;39m%}"- , testCase "Should start the prompt with a reset color control sequence" $+ , testCase "Other: Should start the prompt with a reset color control sequence" $ testWriterWithConfig (zeroOutputConfig Other) resetPromptAtBeginning @?= "\x1b[0;39m"+ , testCase "TMUX: Should start the prompt with a reset color control sequence" $+ testWriterWithConfig (zeroOutputConfig TMUX) resetPromptAtBeginning @?= "#[fg=default]"+ , testCase "NONE: Should start the prompt with a reset color control sequence" $+ testWriterWithConfig (zeroOutputConfig NONE) resetPromptAtBeginning @?= "" ] -testAddGitRepoIndicator :: TestTree-testAddGitRepoIndicator = testGroup "#addGitRepoIndicator"- [ testGroup "Default Config"- [ testCase "ZSH: default config: hardcoded character" $- testWriterWithConfig (zeroOutputConfig ZSH) addGitRepoIndicator @?= "ᚴ "+_testAddGitDefaultRepoIndicator :: Shell -> TestTree+_testAddGitDefaultRepoIndicator shell =+ testCase ((show shell) ++ ": default config: hardcoded character") $+ testWriterWithConfig (zeroOutputConfig shell) addGitRepoIndicator @?= "ᚴ " - , testCase "Other: default config: hardcoded character" $- testWriterWithConfig (zeroOutputConfig Other) addGitRepoIndicator @?= "ᚴ "- ]- , testGroup "Custom Config"- [ testCase "ZSH: custom config: hardcoded character" $- testWriterWithConfig- (buildOutputConfig ZSH zeroGitRepoState $ defaultConfig { confRepoIndicator = "indic" })- addGitRepoIndicator- @?= "indic "+_testAddGitCustomRepoIndicator :: Shell -> TestTree+_testAddGitCustomRepoIndicator shell =+ testCase ((show shell) ++ ": custom config: hardcoded character") $+ testWriterWithConfig+ (buildOutputConfig shell zeroGitRepoState $ defaultConfig { confRepoIndicator = "indic" })+ addGitRepoIndicator+ @?= "indic " - , testCase "Other: custom config: hardcoded character" $- testWriterWithConfig- (buildOutputConfig ZSH zeroGitRepoState $ defaultConfig { confRepoIndicator = "indic" })- addGitRepoIndicator- @?= "indic "- ]+testAddGitRepoIndicator :: TestTree+testAddGitRepoIndicator = testGroup "#addGitRepoIndicator"+ [ testGroup "Default Config" $ fmap _testAddGitDefaultRepoIndicator allPrompts+ , testGroup "Custom Config" $ fmap _testAddGitCustomRepoIndicator allPrompts ] customConfigNoTrackedUpstreamIndicator :: Config@@ -69,22 +71,28 @@ , confNoTrackedUpstreamIndicatorIntensity = Dull } -testAddNoTrackedUpstreamIndicator :: TestTree-testAddNoTrackedUpstreamIndicator = testGroup "#addTrackedUpstreamIndicator"- [ testGroup "Default Config"- [ testCase "ZSH: with an upstream" $- testWriterWithConfig- (buildOutputConfig ZSH (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) defaultConfig)+_testUpstreamIndicatorWithUpstreamDefaultConfig :: Shell -> TestTree+_testUpstreamIndicatorWithUpstreamDefaultConfig shell =+ testCase ((show shell) ++ ": with an upstream") $+ testWriterWithConfig+ (buildOutputConfig shell (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) defaultConfig) addNoTrackedUpstreamIndicator @?= "" - , testCase "Other: with an upstream" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) defaultConfig)+_testUpstreamIndicatorWithUpstreamCustomConfig :: Shell -> TestTree+_testUpstreamIndicatorWithUpstreamCustomConfig shell =+ testCase ((show shell) ++ ": with an upstream") $+ testWriterWithConfig+ (buildOutputConfig shell (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) customConfigNoTrackedUpstreamIndicator) addNoTrackedUpstreamIndicator @?= "" - , testCase "ZSH: with no upstream" $+testAddNoTrackedUpstreamIndicator :: TestTree+testAddNoTrackedUpstreamIndicator = testGroup "#addTrackedUpstreamIndicator"+ [ testGroup "Default Config - upstream" $ fmap _testUpstreamIndicatorWithUpstreamDefaultConfig allPrompts+ , testGroup "Custom Config - upstream" $ fmap _testUpstreamIndicatorWithUpstreamCustomConfig allPrompts+ , testGroup "Default Config - no upstream"+ [ testCase "ZSH: with no upstream" $ testWriterWithConfig (zeroOutputConfig ZSH) addNoTrackedUpstreamIndicator @?= "%{\x1b[1;31m%}upstream%{\x1b[0;39m%} %{\x1b[1;31m%}\9889%{\x1b[0;39m%} "@@ -93,22 +101,20 @@ testWriterWithConfig (zeroOutputConfig Other) addNoTrackedUpstreamIndicator @?= "\x1b[1;31mupstream\x1b[0;39m \x1b[1;31m\9889\x1b[0;39m "- ]- , testGroup "Custom Config"- [ testCase "ZSH: with an upstream" $- testWriterWithConfig- (buildOutputConfig ZSH (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) customConfigNoTrackedUpstreamIndicator)- addNoTrackedUpstreamIndicator- @?= "" - , testCase "Other: with an upstream" $+ , testCase "TMUX: with no upstream" $ testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitRemoteTrackingBranch = "foo" }) customConfigNoTrackedUpstreamIndicator)- addNoTrackedUpstreamIndicator- @?= ""+ (zeroOutputConfig TMUX) addNoTrackedUpstreamIndicator+ @?= "#[fg=brightred]upstream#[fg=default] #[fg=brightred]\9889#[fg=default] " - , testCase "ZSH: with no upstream" $+ , testCase "NONE: with no upstream" $ testWriterWithConfig+ (zeroOutputConfig NONE) addNoTrackedUpstreamIndicator+ @?= "upstream \9889 "+ ]+ , testGroup "Custom Config - no upstream"+ [ testCase "ZSH: with no upstream" $+ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState) customConfigNoTrackedUpstreamIndicator) addNoTrackedUpstreamIndicator @?= "%{\x1b[36m%}foo%{\x1b[0;39m%} %{\x1b[32m%}bar%{\x1b[0;39m%} "@@ -118,6 +124,18 @@ (buildOutputConfig Other (zeroGitRepoState) customConfigNoTrackedUpstreamIndicator) addNoTrackedUpstreamIndicator @?= "\x1b[36mfoo\x1b[0;39m \x1b[32mbar\x1b[0;39m "++ , testCase "TMUX: with no upstream" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState) customConfigNoTrackedUpstreamIndicator)+ addNoTrackedUpstreamIndicator+ @?= "#[fg=cyan]foo#[fg=default] #[fg=green]bar#[fg=default] "++ , testCase "NONE: with no upstream" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState) customConfigNoTrackedUpstreamIndicator)+ addNoTrackedUpstreamIndicator+ @?= "foo bar " ] ] @@ -155,6 +173,30 @@ , testCase "Other: commits to pull and to push" $ testMergeBranchCommitsToPushAndPull Other defaultConfig @?= "\120366 4\x1b[1;32m\8644\x1b[0;39m4 "++ , testCase "TMUX: commits to pull" $+ testMergeBranchCommitsToPull TMUX defaultConfig @?=+ "\120366 #[fg=brightgreen]\8594#[fg=default] 2 "++ , testCase "TMUX: commits to push" $+ testMergeBranchCommitsToPush TMUX defaultConfig @?=+ "\120366 #[fg=brightgreen]\8592#[fg=default] 2 "++ , testCase "TMUX: commits to pull and to push" $+ testMergeBranchCommitsToPushAndPull TMUX defaultConfig @?=+ "\120366 4#[fg=brightgreen]\8644#[fg=default]4 "++ , testCase "NONE: commits to pull" $+ testMergeBranchCommitsToPull NONE defaultConfig @?=+ "\120366 \8594 2 "++ , testCase "NONE: commits to push" $+ testMergeBranchCommitsToPush NONE defaultConfig @?=+ "\120366 \8592 2 "++ , testCase "NONE: commits to pull and to push" $+ testMergeBranchCommitsToPushAndPull NONE defaultConfig @?=+ "\120366 4\8644\&4 " ] , testGroup "Custom Config"@@ -181,6 +223,30 @@ , testCase "Other: commits to pull and to push" $ testMergeBranchCommitsToPushAndPull Other customConfigMergeBranchCommits @?= "foo 4\x1b[1;32mpull-push\x1b[0;39m4 "++ , testCase "TMUX: commits to pull" $+ testMergeBranchCommitsToPull TMUX customConfigMergeBranchCommits @?=+ "foo #[fg=brightgreen]pull#[fg=default] 2 "++ , testCase "TMUX: commits to push" $+ testMergeBranchCommitsToPush TMUX customConfigMergeBranchCommits @?=+ "foo #[fg=brightgreen]push#[fg=default] 2 "++ , testCase "TMUX: commits to pull and to push" $+ testMergeBranchCommitsToPushAndPull TMUX customConfigMergeBranchCommits @?=+ "foo 4#[fg=brightgreen]pull-push#[fg=default]4 "++ , testCase "NONE: commits to pull" $+ testMergeBranchCommitsToPull NONE customConfigMergeBranchCommits @?=+ "foo pull 2 "++ , testCase "NONE: commits to push" $+ testMergeBranchCommitsToPush NONE customConfigMergeBranchCommits @?=+ "foo push 2 "++ , testCase "NONE: commits to pull and to push" $+ testMergeBranchCommitsToPushAndPull NONE customConfigMergeBranchCommits @?=+ "foo 4pull-push4 " ] ] @@ -204,47 +270,95 @@ addLocalBranchName @?= "[%{\x1b[0;39m%}foo%{\x1b[0;39m%}] " - , testCase "Other: should display the name of the current branch if we are at the HEAD of any" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitLocalBranch = "foo" }) defaultConfig)- addLocalBranchName- @?= "[\x1b[0;39mfoo\x1b[0;39m] "- , testCase "ZSH: should display the current commit tag if we are not on one" $ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState { gitCommitTag = "v1.1.1" }) defaultConfig) addLocalBranchName @?= "[%{\x1b[1;33m%}detached@v1.1.1%{\x1b[0;39m%}] " - , testCase "Other: should display the current commit tog if we are on one" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitCommitTag = "v1.1.1" }) defaultConfig)- addLocalBranchName- @?= "[\x1b[1;33mdetached@v1.1.1\x1b[0;39m] "- , testCase "ZSH: should display the current commit SHA if we are not on a branch's HEAD" $ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) defaultConfig) addLocalBranchName @?= "[%{\x1b[1;33m%}detached@3d25ef%{\x1b[0;39m%}] " - , testCase "Other: should display the current commit SHA if we are not on a branch's HEAD" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) defaultConfig)- addLocalBranchName- @?= "[\x1b[1;33mdetached@3d25ef\x1b[0;39m] "- , testCase "ZSH: should prefer the current tag over the commit SHA if we are not on a branch's HEAD" $ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState { gitCommitShortSHA = "3d25ef", gitCommitTag = "v1.2.3" }) defaultConfig) addLocalBranchName @?= "[%{\x1b[1;33m%}detached@v1.2.3%{\x1b[0;39m%}] " + , testCase "Other: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig Other (zeroGitRepoState { gitLocalBranch = "foo" }) defaultConfig)+ addLocalBranchName+ @?= "[\x1b[0;39mfoo\x1b[0;39m] "++ , testCase "Other: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig Other (zeroGitRepoState { gitCommitTag = "v1.1.1" }) defaultConfig)+ addLocalBranchName+ @?= "[\x1b[1;33mdetached@v1.1.1\x1b[0;39m] "++ , testCase "Other: should display the current commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig Other (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) defaultConfig)+ addLocalBranchName+ @?= "[\x1b[1;33mdetached@3d25ef\x1b[0;39m] "+ , testCase "Other: should prefer the current tag over the commit SHA if we are not on a branch's HEAD" $ testWriterWithConfig (buildOutputConfig Other (zeroGitRepoState { gitCommitShortSHA = "3d25ef", gitCommitTag = "v1.2.3" }) defaultConfig) addLocalBranchName @?= "[\x1b[1;33mdetached@v1.2.3\x1b[0;39m] "++ , testCase "TMUX: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitLocalBranch = "foo" }) defaultConfig)+ addLocalBranchName+ @?= "[#[fg=default]foo#[fg=default]] "++ , testCase "TMUX: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitCommitTag = "v1.1.1" }) defaultConfig)+ addLocalBranchName+ @?= "[#[fg=brightyellow]detached@v1.1.1#[fg=default]] "++ , testCase "TMUX: should display the current commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) defaultConfig)+ addLocalBranchName+ @?= "[#[fg=brightyellow]detached@3d25ef#[fg=default]] "++ , testCase "TMUX: should prefer the current tag over the commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitCommitShortSHA = "3d25ef", gitCommitTag = "v1.2.3" }) defaultConfig)+ addLocalBranchName+ @?= "[#[fg=brightyellow]detached@v1.2.3#[fg=default]] "++ , testCase "NONE: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitLocalBranch = "foo" }) defaultConfig)+ addLocalBranchName+ @?= "[foo] "++ , testCase "NONE: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitCommitTag = "v1.1.1" }) defaultConfig)+ addLocalBranchName+ @?= "[detached@v1.1.1] "++ , testCase "NONE: should display the current commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) defaultConfig)+ addLocalBranchName+ @?= "[detached@3d25ef] "++ , testCase "NONE: should prefer the current tag over the commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitCommitShortSHA = "3d25ef", gitCommitTag = "v1.2.3" }) defaultConfig)+ addLocalBranchName+ @?= "[detached@v1.2.3] " ] , testGroup "Custom Config" [ testCase "ZSH: should display the name of the current branch if we are at the HEAD of any" $@@ -253,35 +367,71 @@ addLocalBranchName @?= "{%{\x1b[36m%}foo%{\x1b[0;39m%}} " - , testCase "Other: should display the name of the current branch if we are at the HEAD of any" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitLocalBranch = "foo" }) customConfigLocalBranchName)- addLocalBranchName- @?= "{\x1b[36mfoo\x1b[0;39m} "- , testCase "ZSH: should display the current commit tag if we are not on one" $ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState { gitCommitTag = "v1.1.1" }) customConfigLocalBranchName) addLocalBranchName @?= "{%{\x1b[35m%}det#!v1.1.1%{\x1b[0;39m%}} " - , testCase "Other: should display the current commit tog if we are on one" $- testWriterWithConfig- (buildOutputConfig Other (zeroGitRepoState { gitCommitTag = "v1.1.1" }) customConfigLocalBranchName)- addLocalBranchName- @?= "{\x1b[35mdet#!v1.1.1\x1b[0;39m} "- , testCase "ZSH: should display the current commit SHA if we are not on a branch's HEAD" $ testWriterWithConfig (buildOutputConfig ZSH (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) customConfigLocalBranchName) addLocalBranchName @?= "{%{\x1b[35m%}det#!3d25ef%{\x1b[0;39m%}} " + , testCase "Other: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig Other (zeroGitRepoState { gitLocalBranch = "foo" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{\x1b[36mfoo\x1b[0;39m} "++ , testCase "Other: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig Other (zeroGitRepoState { gitCommitTag = "v1.1.1" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{\x1b[35mdet#!v1.1.1\x1b[0;39m} "+ , testCase "Other: should display the current commit SHA if we are not on a branch's HEAD" $ testWriterWithConfig (buildOutputConfig Other (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) customConfigLocalBranchName) addLocalBranchName @?= "{\x1b[35mdet#!3d25ef\x1b[0;39m} "++ , testCase "TMUX: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitLocalBranch = "foo" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{#[fg=cyan]foo#[fg=default]} "++ , testCase "TMUX: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitCommitTag = "v1.1.1" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{#[fg=magenta]det#!v1.1.1#[fg=default]} "++ , testCase "TMUX: should display the current commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{#[fg=magenta]det#!3d25ef#[fg=default]} "++ , testCase "NONE: should display the name of the current branch if we are at the HEAD of any" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitLocalBranch = "foo" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{foo} "++ , testCase "NONE: should display the current commit tog if we are on one" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitCommitTag = "v1.1.1" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{det#!v1.1.1} "++ , testCase "NONE: should display the current commit SHA if we are not on a branch's HEAD" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitCommitShortSHA = "3d25ef" }) customConfigLocalBranchName)+ addLocalBranchName+ @?= "{det#!3d25ef} " ] ] @@ -324,6 +474,30 @@ , testCase "Other: commits to pull and to push" $ testCommitsToPushAndPull Other defaultConfig @?= "4\x1b[1;32m⥯\x1b[0;39m4 "++ , testCase "TMUX: commits to pull" $+ testCommitsToPull TMUX defaultConfig @?=+ "2#[fg=brightred]\8595#[fg=default] "++ , testCase "TMUX: commits to push" $+ testCommitsToPush TMUX defaultConfig @?=+ "2#[fg=brightgreen]\8593#[fg=default] "++ , testCase "TMUX: commits to pull and to push" $+ testCommitsToPushAndPull TMUX defaultConfig @?=+ "4#[fg=brightgreen]⥯#[fg=default]4 "++ , testCase "NONE: commits to pull" $+ testCommitsToPull NONE defaultConfig @?=+ "2\8595 "++ , testCase "NONE: commits to push" $+ testCommitsToPush NONE defaultConfig @?=+ "2\8593 "++ , testCase "NONE: commits to pull and to push" $+ testCommitsToPushAndPull NONE defaultConfig @?=+ "4⥯4 " ] , testGroup "Custom Config" [ testCase "ZSH: commits to pull" $@@ -349,6 +523,30 @@ , testCase "Other: commits to pull and to push" $ testCommitsToPushAndPull Other customConfigLocalCommits @?= "4\x1b[37mpush-pull\x1b[0;39m4 "++ , testCase "TMUX: commits to pull" $+ testCommitsToPull TMUX customConfigLocalCommits @?=+ "2#[fg=magenta]pull#[fg=default] "++ , testCase "TMUX: commits to push" $+ testCommitsToPush TMUX customConfigLocalCommits @?=+ "2#[fg=cyan]push#[fg=default] "++ , testCase "TMUX: commits to pull and to push" $+ testCommitsToPushAndPull TMUX customConfigLocalCommits @?=+ "4#[fg=white]push-pull#[fg=default]4 "++ , testCase "NONE: commits to pull" $+ testCommitsToPull NONE customConfigLocalCommits @?=+ "2pull "++ , testCase "NONE: commits to push" $+ testCommitsToPush NONE customConfigLocalCommits @?=+ "2push "++ , testCase "NONE: commits to pull and to push" $+ testCommitsToPushAndPull NONE customConfigLocalCommits @?=+ "4push-pull4 " ] ] @@ -407,6 +605,9 @@ , testCase "ZSH: with Renamed Changes" $ testRenamedChange ZSH defaultConfig @?= "2%{\x1b[1;32m%}R%{\x1b[0;39m%} " + , testCase "ZSH: with every kind of Changes" $+ testEveryRepoChange ZSH defaultConfig @?= "6%{\x1b[1;32m%}A%{\x1b[0;39m%}8%{\x1b[1;32m%}D%{\x1b[0;39m%}7%{\x1b[1;32m%}M%{\x1b[0;39m%}1%{\x1b[1;32m%}R%{\x1b[0;39m%} 5%{\x1b[1;31m%}D%{\x1b[0;39m%}4%{\x1b[1;31m%}M%{\x1b[0;39m%} 3%{\x1b[1;37m%}A%{\x1b[0;39m%} 2%{\x1b[1;32m%}C%{\x1b[0;39m%} "+ , testCase "Other: with Local Add Changes" $ testLocalAddChange Other defaultConfig @?= "2\x1b[1;37mA\x1b[0;39m " @@ -431,11 +632,62 @@ , testCase "Other: with Renamed Changes" $ testRenamedChange Other defaultConfig @?= "2\x1b[1;32mR\x1b[0;39m " - , testCase "ZSH: with every kind of Changes" $- testEveryRepoChange ZSH defaultConfig @?= "6%{\x1b[1;32m%}A%{\x1b[0;39m%}8%{\x1b[1;32m%}D%{\x1b[0;39m%}7%{\x1b[1;32m%}M%{\x1b[0;39m%}1%{\x1b[1;32m%}R%{\x1b[0;39m%} 5%{\x1b[1;31m%}D%{\x1b[0;39m%}4%{\x1b[1;31m%}M%{\x1b[0;39m%} 3%{\x1b[1;37m%}A%{\x1b[0;39m%} 2%{\x1b[1;32m%}C%{\x1b[0;39m%} "- , testCase "Other: with every kind of Changes" $ testEveryRepoChange Other defaultConfig @?= "6\x1b[1;32mA\x1b[0;39m8\x1b[1;32mD\x1b[0;39m7\x1b[1;32mM\x1b[0;39m1\x1b[1;32mR\x1b[0;39m 5\x1b[1;31mD\x1b[0;39m4\x1b[1;31mM\x1b[0;39m 3\x1b[1;37mA\x1b[0;39m 2\x1b[1;32mC\x1b[0;39m "++ , testCase "TMUX: with Local Add Changes" $+ testLocalAddChange TMUX defaultConfig @?= "2#[fg=brightwhite]A#[fg=default] "++ , testCase "TMUX: with Local Mod Changes" $+ testLocalModChange TMUX defaultConfig @?= "2#[fg=brightred]M#[fg=default] "++ , testCase "TMUX: with Local Del Changes" $+ testLocalDelChange TMUX defaultConfig @?= "2#[fg=brightred]D#[fg=default] "++ , testCase "TMUX: with Index Add Changes" $+ testIndexAddChange TMUX defaultConfig @?= "2#[fg=brightgreen]A#[fg=default] "++ , testCase "TMUX: with Index Mod Changes" $+ testIndexModChange TMUX defaultConfig @?= "2#[fg=brightgreen]M#[fg=default] "++ , testCase "TMUX: with Index Del Changes" $+ testIndexDelChange TMUX defaultConfig @?= "2#[fg=brightgreen]D#[fg=default] "++ , testCase "TMUX: with Conflicted Changes" $+ testConflictedChange TMUX defaultConfig @?= "2#[fg=brightgreen]C#[fg=default] "++ , testCase "TMUX: with Renamed Changes" $+ testRenamedChange TMUX defaultConfig @?= "2#[fg=brightgreen]R#[fg=default] "++ , testCase "TMUX: with every kind of Changes" $+ testEveryRepoChange TMUX defaultConfig @?= "6#[fg=brightgreen]A#[fg=default]8#[fg=brightgreen]D#[fg=default]7#[fg=brightgreen]M#[fg=default]1#[fg=brightgreen]R#[fg=default] 5#[fg=brightred]D#[fg=default]4#[fg=brightred]M#[fg=default] 3#[fg=brightwhite]A#[fg=default] 2#[fg=brightgreen]C#[fg=default] "++ , testCase "NONE: with Local Add Changes" $+ testLocalAddChange NONE defaultConfig @?= "2A "++ , testCase "NONE: with Local Mod Changes" $+ testLocalModChange NONE defaultConfig @?= "2M "++ , testCase "NONE: with Local Del Changes" $+ testLocalDelChange NONE defaultConfig @?= "2D "++ , testCase "NONE: with Index Add Changes" $+ testIndexAddChange NONE defaultConfig @?= "2A "++ , testCase "NONE: with Index Mod Changes" $+ testIndexModChange NONE defaultConfig @?= "2M "++ , testCase "NONE: with Index Del Changes" $+ testIndexDelChange NONE defaultConfig @?= "2D "++ , testCase "NONE: with Conflicted Changes" $+ testConflictedChange NONE defaultConfig @?= "2C "++ , testCase "NONE: with Renamed Changes" $+ testRenamedChange NONE defaultConfig @?= "2R "++ , testCase "NONE: with every kind of Changes" $+ testEveryRepoChange NONE defaultConfig @?= "6A8D7M1R 5D4M 3A 2C " ] , testGroup "Custom Config" [ testCase "ZSH: with Local Add Changes" $@@ -462,6 +714,9 @@ , testCase "ZSH: with Renamed Changes" $ testRenamedChange ZSH customChangeConfig @?= "2%{\x1b[36m%}S%{\x1b[0;39m%} " + , testCase "ZSH: with every kind of Changes" $+ testEveryRepoChange ZSH customChangeConfig @?= "6%{\x1b[36m%}B%{\x1b[0;39m%}8%{\x1b[36m%}E%{\x1b[0;39m%}7%{\x1b[36m%}N%{\x1b[0;39m%}1%{\x1b[36m%}S%{\x1b[0;39m%} 5%{\x1b[34m%}E%{\x1b[0;39m%}4%{\x1b[34m%}N%{\x1b[0;39m%} 3%{\x1b[35m%}B%{\x1b[0;39m%} 2%{\x1b[36m%}D%{\x1b[0;39m%} "+ , testCase "Other: with Local Add Changes" $ testLocalAddChange Other customChangeConfig @?= "2\x1b[35mB\x1b[0;39m " @@ -486,11 +741,62 @@ , testCase "Other: with Renamed Changes" $ testRenamedChange Other customChangeConfig @?= "2\x1b[36mS\x1b[0;39m " - , testCase "ZSH: with every kind of Changes" $- testEveryRepoChange ZSH customChangeConfig @?= "6%{\x1b[36m%}B%{\x1b[0;39m%}8%{\x1b[36m%}E%{\x1b[0;39m%}7%{\x1b[36m%}N%{\x1b[0;39m%}1%{\x1b[36m%}S%{\x1b[0;39m%} 5%{\x1b[34m%}E%{\x1b[0;39m%}4%{\x1b[34m%}N%{\x1b[0;39m%} 3%{\x1b[35m%}B%{\x1b[0;39m%} 2%{\x1b[36m%}D%{\x1b[0;39m%} "- , testCase "Other: with every kind of Changes" $ testEveryRepoChange Other customChangeConfig @?= "6\x1b[36mB\x1b[0;39m8\x1b[36mE\x1b[0;39m7\x1b[36mN\x1b[0;39m1\x1b[36mS\x1b[0;39m 5\x1b[34mE\x1b[0;39m4\x1b[34mN\x1b[0;39m 3\x1b[35mB\x1b[0;39m 2\x1b[36mD\x1b[0;39m "++ , testCase "TMUX: with Local Add Changes" $+ testLocalAddChange TMUX customChangeConfig @?= "2#[fg=magenta]B#[fg=default] "++ , testCase "TMUX: with Local Mod Changes" $+ testLocalModChange TMUX customChangeConfig @?= "2#[fg=blue]N#[fg=default] "++ , testCase "TMUX: with Local Del Changes" $+ testLocalDelChange TMUX customChangeConfig @?= "2#[fg=blue]E#[fg=default] "++ , testCase "TMUX: with Index Add Changes" $+ testIndexAddChange TMUX customChangeConfig @?= "2#[fg=cyan]B#[fg=default] "++ , testCase "TMUX: with Index Mod Changes" $+ testIndexModChange TMUX customChangeConfig @?= "2#[fg=cyan]N#[fg=default] "++ , testCase "TMUX: with Index Del Changes" $+ testIndexDelChange TMUX customChangeConfig @?= "2#[fg=cyan]E#[fg=default] "++ , testCase "TMUX: with Conflicted Changes" $+ testConflictedChange TMUX customChangeConfig @?= "2#[fg=cyan]D#[fg=default] "++ , testCase "TMUX: with Renamed Changes" $+ testRenamedChange TMUX customChangeConfig @?= "2#[fg=cyan]S#[fg=default] "++ , testCase "TMUX: with every kind of Changes" $+ testEveryRepoChange TMUX customChangeConfig @?= "6#[fg=cyan]B#[fg=default]8#[fg=cyan]E#[fg=default]7#[fg=cyan]N#[fg=default]1#[fg=cyan]S#[fg=default] 5#[fg=blue]E#[fg=default]4#[fg=blue]N#[fg=default] 3#[fg=magenta]B#[fg=default] 2#[fg=cyan]D#[fg=default] "++ , testCase "NONE: with Local Add Changes" $+ testLocalAddChange NONE customChangeConfig @?= "2B "++ , testCase "NONE: with Local Mod Changes" $+ testLocalModChange NONE customChangeConfig @?= "2N "++ , testCase "NONE: with Local Del Changes" $+ testLocalDelChange NONE customChangeConfig @?= "2E "++ , testCase "NONE: with Index Add Changes" $+ testIndexAddChange NONE customChangeConfig @?= "2B "++ , testCase "NONE: with Index Mod Changes" $+ testIndexModChange NONE customChangeConfig @?= "2N "++ , testCase "NONE: with Index Del Changes" $+ testIndexDelChange NONE customChangeConfig @?= "2E "++ , testCase "NONE: with Conflicted Changes" $+ testConflictedChange NONE customChangeConfig @?= "2D "++ , testCase "NONE: with Renamed Changes" $+ testRenamedChange NONE customChangeConfig @?= "2S "++ , testCase "NONE: with every kind of Changes" $+ testEveryRepoChange NONE customChangeConfig @?= "6B8E7N1S 5E4N 3B 2D " ] ] @@ -513,6 +819,16 @@ testWriterWithConfig (buildOutputConfig Other (zeroGitRepoState { gitStashCount = 2 }) defaultConfig) addStashes @?= "2\x1b[1;32m\8801\x1b[0;39m "++ , testCase "TMUX: hardcoded character" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitStashCount = 2 }) defaultConfig) addStashes+ @?= "2#[fg=brightgreen]\8801#[fg=default] "++ , testCase "NONE: hardcoded character" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitStashCount = 2 }) defaultConfig) addStashes+ @?= "2\8801 " ] , testGroup "Custom Config" [ testCase "ZSH: hardcoded character" $@@ -524,6 +840,16 @@ testWriterWithConfig (buildOutputConfig Other (zeroGitRepoState { gitStashCount = 2 }) customStashConfig) addStashes @?= "2\x1b[36mstash\x1b[0;39m "++ , testCase "TMUX: hardcoded character" $+ testWriterWithConfig+ (buildOutputConfig TMUX (zeroGitRepoState { gitStashCount = 2 }) customStashConfig) addStashes+ @?= "2#[fg=cyan]stash#[fg=default] "++ , testCase "NONE: hardcoded character" $+ testWriterWithConfig+ (buildOutputConfig NONE (zeroGitRepoState { gitStashCount = 2 }) customStashConfig) addStashes+ @?= "2stash " ] ]