aboutsummaryrefslogtreecommitdiff
path: root/test/segments/vcs-git.spec
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-11-18 11:26:26 +0300
committerGitHub <noreply@github.com>2018-11-18 11:26:26 +0300
commitd1e4c4c988de048092181c4403a263a6aa1bbdad (patch)
treec82de51b4e3b5431a63c7ba91a161e3c5db44704 /test/segments/vcs-git.spec
parent724781e89681d2f34bd3760ef710a58a093b5595 (diff)
parent6df2ba0ae02e585c557b2ff2ccb9f6f207a7c6b8 (diff)
Merge pull request #1080 from macserv/port/vcs-segment-untracked-file-check
[Bugfix] Port #1071 to `master` (Fix fatal errors emitted by untracked file check in vcs.zsh)
Diffstat (limited to 'test/segments/vcs-git.spec')
-rwxr-xr-xtest/segments/vcs-git.spec29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec
index ab2962c8..da28b955 100755
--- a/test/segments/vcs-git.spec
+++ b/test/segments/vcs-git.spec
@@ -503,4 +503,33 @@ function testBranchNameScriptingVulnerability() {
assertEquals '%K{002} %F{000} $(./evil_script.sh) %k%F{002}%f ' "$(build_left_prompt)"
}
+function testGitSubmoduleWorks() {
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
+ local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY="true"
+ unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND
+
+ mkdir ../submodule
+ cd ../submodule
+ git init 1>/dev/null
+ touch "i-am-tracked.txt"
+ git add . 1>/dev/null && git commit -m "Initial Commit" 1>/dev/null
+
+ local submodulePath="${PWD}"
+
+ cd -
+ git submodule add "${submodulePath}" 2>/dev/null
+ git commit -m "Add submodule" 1>/dev/null
+
+ cd submodule
+
+ source "${P9K_HOME}/powerlevel9k.zsh-theme"
+
+ local result="$(build_left_prompt)"
+ [[ "$result" =~ ".*(is outside repository)+" ]] && return 1
+
+ assertEquals "%K{002} %F{000} master %k%F{002}%f " "$result"
+}
+
+
source shunit2/shunit2