1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-18 02:30:07 +00:00

Fix configuration errors in the tests

This commit is contained in:
Dominik Ritter 2018-11-15 01:55:42 +01:00
parent 7bc5366af1
commit 1b7e41964c
2 changed files with 6 additions and 2 deletions

View file

@ -491,6 +491,8 @@ function testDetectingUntrackedFilesInCleanSubdirectoryWorks() {
} }
function testBranchNameScriptingVulnerability() { function testBranchNameScriptingVulnerability() {
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
echo "#!/bin/sh\n\necho 'hacked'\n" > evil_script.sh echo "#!/bin/sh\n\necho 'hacked'\n" > evil_script.sh
chmod +x evil_script.sh chmod +x evil_script.sh
@ -498,7 +500,7 @@ function testBranchNameScriptingVulnerability() {
git add . 2>/dev/null git add . 2>/dev/null
git commit -m "Initial commit" >/dev/null git commit -m "Initial commit" >/dev/null
assertEquals "%K{002} %F{000} %f%F{000} \$(./evil_script.sh) %k%F{002}%f " "$(__p9k_build_left_prompt)" assertEquals "%K{002} %F{000} %f%F{000} \$(./evil_script.sh) %k%F{002}%f " "$(build_left_prompt)"
} }
source shunit2/shunit2 source shunit2/shunit2

View file

@ -205,6 +205,8 @@ function testBookmarkIconWorks() {
} }
function testBranchNameScriptingVulnerability() { function testBranchNameScriptingVulnerability() {
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
echo "#!/bin/sh\n\necho 'hacked'\n" > evil_script.sh echo "#!/bin/sh\n\necho 'hacked'\n" > evil_script.sh
chmod +x evil_script.sh chmod +x evil_script.sh
@ -212,7 +214,7 @@ function testBranchNameScriptingVulnerability() {
hg add . >/dev/null hg add . >/dev/null
hg commit -m "Initial commit" >/dev/null hg commit -m "Initial commit" >/dev/null
assertEquals "%K{002} %F{000} %f%F{000} \$(./evil_script.sh) %k%F{002}%f " "$(build_left_prompt)" assertEquals "%K{002} %F{000} \$(./evil_script.sh) %k%F{002}%f " "$(build_left_prompt)"
} }
source shunit2/shunit2 source shunit2/shunit2