mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Port git submodule test from next
.
This commit is contained in:
parent
574ee6dc1c
commit
6df2ba0ae0
1 changed files with 29 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue