mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
Fix tests on older ZSH versions
This commit is contained in:
parent
4b32b2c0b2
commit
16e5e14af7
@ -13,7 +13,8 @@ function setUp() {
|
|||||||
|
|
||||||
function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world)
|
||||||
# Unset anacona variables
|
# Unset anacona variables
|
||||||
unset CONDA_ENV_PATH
|
unset CONDA_ENV_PATH
|
||||||
unset CONDA_PREFIX
|
unset CONDA_PREFIX
|
||||||
@ -24,7 +25,8 @@ function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
|||||||
function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
||||||
CONDA_ENV_PATH=/tmp
|
CONDA_ENV_PATH=/tmp
|
||||||
unset CONDA_PREFIX
|
unset CONDA_PREFIX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||||
|
|
||||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmp) %k%F{blue}%f " "$(build_left_prompt)"
|
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmp) %k%F{blue}%f " "$(build_left_prompt)"
|
||||||
@ -33,7 +35,8 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
|||||||
function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
||||||
unset CONDA_ENV_PATH
|
unset CONDA_ENV_PATH
|
||||||
local CONDA_PREFIX="test"
|
local CONDA_PREFIX="test"
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||||
|
|
||||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(test) %k%F{blue}%f " "$(build_left_prompt)"
|
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(test) %k%F{blue}%f " "$(build_left_prompt)"
|
||||||
@ -42,7 +45,8 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
|||||||
function testAnacondaSegmentWorks() {
|
function testAnacondaSegmentWorks() {
|
||||||
local CONDA_ENV_PATH=/tmp
|
local CONDA_ENV_PATH=/tmp
|
||||||
local CONDA_PREFIX="test"
|
local CONDA_PREFIX="test"
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||||
|
|
||||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)"
|
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)"
|
||||||
|
@ -23,7 +23,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {
|
|||||||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||||
cd /tmp/powerlevel9k-test
|
cd /tmp/powerlevel9k-test
|
||||||
|
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
||||||
|
|
||||||
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
@ -40,7 +40,8 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec
|
|||||||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||||
cd /tmp/powerlevel9k-test/1/12/123/1234/12345
|
cd /tmp/powerlevel9k-test/1/12/123/1234/12345
|
||||||
|
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
||||||
|
|
||||||
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ function setUp() {
|
|||||||
|
|
||||||
function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world)
|
||||||
alias jobs="nojobs 2>/dev/null"
|
alias jobs="nojobs 2>/dev/null"
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
@ -23,7 +24,8 @@ function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
|||||||
|
|
||||||
function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
|
function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
|
||||||
unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE
|
unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
||||||
jobs() {
|
jobs() {
|
||||||
echo '[1] + 30444 suspended nvim xx'
|
echo '[1] + 30444 suspended nvim xx'
|
||||||
}
|
}
|
||||||
@ -35,7 +37,8 @@ function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
|
|||||||
|
|
||||||
function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
|
function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
|
||||||
unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE
|
unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
||||||
jobs() {
|
jobs() {
|
||||||
echo "[1] 31190 suspended nvim xx"
|
echo "[1] 31190 suspended nvim xx"
|
||||||
echo "[2] - 31194 suspended nvim xx2"
|
echo "[2] - 31194 suspended nvim xx2"
|
||||||
@ -49,7 +52,8 @@ function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
|
|||||||
|
|
||||||
function testBackgroundJobsSegmentWithVerboseMode() {
|
function testBackgroundJobsSegmentWithVerboseMode() {
|
||||||
local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
|
local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs)
|
||||||
jobs() {
|
jobs() {
|
||||||
echo "[1] 31190 suspended nvim xx"
|
echo "[1] 31190 suspended nvim xx"
|
||||||
echo "[2] - 31194 suspended nvim xx2"
|
echo "[2] - 31194 suspended nvim xx2"
|
||||||
|
@ -65,7 +65,6 @@ function makeBatterySay() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
|
function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "Now drawing from 'Battery Power'
|
makeBatterySay "Now drawing from 'Battery Power'
|
||||||
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
|
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
|
||||||
|
|
||||||
@ -74,7 +73,6 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "Now drawing from 'Battery Power'
|
makeBatterySay "Now drawing from 'Battery Power'
|
||||||
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
|
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
|
||||||
|
|
||||||
@ -83,7 +81,6 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "Now drawing from 'Battery Power'
|
makeBatterySay "Now drawing from 'Battery Power'
|
||||||
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
|
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
|
||||||
|
|
||||||
@ -92,7 +89,6 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "Now drawing from 'Battery Power'
|
makeBatterySay "Now drawing from 'Battery Power'
|
||||||
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
|
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
|
||||||
|
|
||||||
@ -109,7 +105,6 @@ function testBatterySegmentIfBatteryIsFullOnOSX() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "Now drawing from 'Battery Power'
|
makeBatterySay "Now drawing from 'Battery Power'
|
||||||
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
|
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
|
||||||
|
|
||||||
@ -118,7 +113,6 @@ function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "4" "Discharging"
|
makeBatterySay "4" "Discharging"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{red%}🔋 %f%F{red}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
assertEquals "%K{black} %F{red%}🔋 %f%F{red}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||||
@ -126,7 +120,6 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "4" "Charging"
|
makeBatterySay "4" "Charging"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||||
@ -134,7 +127,6 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "10" "Discharging"
|
makeBatterySay "10" "Discharging"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
assertEquals "%K{black} %F{white%}🔋 %f%F{white}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||||
@ -142,7 +134,6 @@ function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "10" "Charging"
|
makeBatterySay "10" "Charging"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||||
@ -150,7 +141,6 @@ function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsFullOnLinux() {
|
function testBatterySegmentIfBatteryIsFullOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "100" "Full"
|
makeBatterySay "100" "Full"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{green%}🔋 %f%F{green}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
assertEquals "%K{black} %F{green%}🔋 %f%F{green}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||||
@ -158,7 +148,6 @@ function testBatterySegmentIfBatteryIsFullOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "50" "Discharging"
|
makeBatterySay "50" "Discharging"
|
||||||
echo "echo 'Batter 0: Discharging, 50%, 01:38:54 remaining'" > ${FOLDER}/usr/bin/acpi
|
echo "echo 'Batter 0: Discharging, 50%, 01:38:54 remaining'" > ${FOLDER}/usr/bin/acpi
|
||||||
chmod +x ${FOLDER}/usr/bin/acpi
|
chmod +x ${FOLDER}/usr/bin/acpi
|
||||||
@ -172,7 +161,6 @@ function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
|||||||
|
|
||||||
function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {
|
function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery)
|
|
||||||
makeBatterySay "50" "Discharging"
|
makeBatterySay "50" "Discharging"
|
||||||
# Todo: Include real acpi output!
|
# Todo: Include real acpi output!
|
||||||
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
|
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
|
||||||
|
@ -23,41 +23,47 @@ function tearDown() {
|
|||||||
function testContextSegmentDoesNotGetRenderedWithDefaultUser() {
|
function testContextSegmentDoesNotGetRenderedWithDefaultUser() {
|
||||||
local DEFAULT_USER=$(whoami)
|
local DEFAULT_USER=$(whoami)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
|
function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
|
||||||
local SSH_CLIENT="putty"
|
local SSH_CLIENT="putty"
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testContextSegmentWithForeignUser() {
|
function testContextSegmentWithForeignUser() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: How to test root?
|
# TODO: How to test root?
|
||||||
function testContextSegmentWithRootUser() {
|
function testContextSegmentWithRootUser() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
startSkipping # Skip test
|
startSkipping # Skip test
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testOverridingContextTemplate() {
|
function testOverridingContextTemplate() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
local POWERLEVEL9K_CONTEXT_TEMPLATE=xx
|
local POWERLEVEL9K_CONTEXT_TEMPLATE=xx
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
|
local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
|
||||||
local DEFAULT_USER=$(whoami)
|
local DEFAULT_USER=$(whoami)
|
||||||
|
|
||||||
@ -65,7 +71,8 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testContextSegmentIsShownIfForced() {
|
function testContextSegmentIsShownIfForced() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||||
local POWERLEVEL9K_ALWAYS_SHOW_USER=true
|
local POWERLEVEL9K_ALWAYS_SHOW_USER=true
|
||||||
local DEFAULT_USER=$(whoami)
|
local DEFAULT_USER=$(whoami)
|
||||||
|
|
||||||
|
@ -12,14 +12,16 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testCustomDirectOutputSegment() {
|
function testCustomDirectOutputSegment() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCustomClosureSegment() {
|
function testCustomClosureSegment() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
function p9k_hello_world() {
|
function p9k_hello_world() {
|
||||||
echo "world"
|
echo "world"
|
||||||
}
|
}
|
||||||
@ -29,7 +31,8 @@ function testCustomClosureSegment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSettingBackgroundForCustomSegment() {
|
function testSettingBackgroundForCustomSegment() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND="yellow"
|
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND="yellow"
|
||||||
|
|
||||||
@ -37,7 +40,8 @@ function testSettingBackgroundForCustomSegment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSettingForegroundForCustomSegment() {
|
function testSettingForegroundForCustomSegment() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND="red"
|
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND="red"
|
||||||
|
|
||||||
@ -45,7 +49,8 @@ function testSettingForegroundForCustomSegment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSettingVisualIdentifierForCustomSegment() {
|
function testSettingVisualIdentifierForCustomSegment() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
||||||
|
|
||||||
@ -53,7 +58,8 @@ function testSettingVisualIdentifierForCustomSegment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSettingVisualIdentifierForegroundColorForCustomSegment() {
|
function testSettingVisualIdentifierForegroundColorForCustomSegment() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR="red"
|
local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR="red"
|
||||||
|
@ -12,10 +12,11 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {
|
function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world)
|
||||||
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias systemd-detect-virt="novirt"
|
alias systemd-detect-virt="novirt"
|
||||||
|
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world)
|
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
@ -23,7 +24,8 @@ function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDetectVirtSegmentIfSystemdReturnsPlainName() {
|
function testDetectVirtSegmentIfSystemdReturnsPlainName() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
||||||
alias systemd-detect-virt="echo 'xxx'"
|
alias systemd-detect-virt="echo 'xxx'"
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow}xxx %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow}xxx %k%F{black}%f " "$(build_left_prompt)"
|
||||||
@ -32,7 +34,8 @@ function testDetectVirtSegmentIfSystemdReturnsPlainName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDetectVirtSegmentIfRootFsIsOnExpectedInode() {
|
function testDetectVirtSegmentIfRootFsIsOnExpectedInode() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
||||||
# Well. This is a weak test, as it fixates the implementation,
|
# Well. This is a weak test, as it fixates the implementation,
|
||||||
# but it is necessary, as the implementation relys on the root
|
# but it is necessary, as the implementation relys on the root
|
||||||
# directory having the inode number "2"..
|
# directory having the inode number "2"..
|
||||||
@ -49,7 +52,8 @@ function testDetectVirtSegmentIfRootFsIsOnExpectedInode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() {
|
function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
||||||
# Well. This is a weak test, as it fixates the implementation,
|
# Well. This is a weak test, as it fixates the implementation,
|
||||||
# but it is necessary, as the implementation relys on the root
|
# but it is necessary, as the implementation relys on the root
|
||||||
# directory having the inode number "2"..
|
# directory having the inode number "2"..
|
||||||
|
@ -32,11 +32,12 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentWhenDiskIsAlmostFull() {
|
function testDiskUsageSegmentWhenDiskIsAlmostFull() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 97% /"
|
/dev/disk1 487219288 471466944 15496344 97% /"
|
||||||
}
|
}
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
|
||||||
|
|
||||||
assertEquals "%K{red} %F{white%}hdd %f%F{white}97%% %k%F{red}%f " "$(build_left_prompt)"
|
assertEquals "%K{red} %F{white%}hdd %f%F{white}97%% %k%F{red}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
@ -44,11 +45,12 @@ function testDiskUsageSegmentWhenDiskIsAlmostFull() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentWhenDiskIsVeryFull() {
|
function testDiskUsageSegmentWhenDiskIsVeryFull() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 94% /"
|
/dev/disk1 487219288 471466944 15496344 94% /"
|
||||||
}
|
}
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
|
||||||
|
|
||||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}94%% %k%F{yellow}%f " "$(build_left_prompt)"
|
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}94%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
@ -56,11 +58,12 @@ function testDiskUsageSegmentWhenDiskIsVeryFull() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
|
function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 4% /"
|
/dev/disk1 487219288 471466944 15496344 4% /"
|
||||||
}
|
}
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
|
||||||
|
|
||||||
assertEquals "%K{black} %F{yellow%}hdd %f%F{yellow}4%% %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{yellow%}hdd %f%F{yellow}4%% %k%F{black}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
@ -68,12 +71,13 @@ function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShouldBeDisplayed() {
|
function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShouldBeDisplayed() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 4% /"
|
/dev/disk1 487219288 471466944 15496344 4% /"
|
||||||
}
|
}
|
||||||
|
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world)
|
|
||||||
local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true
|
local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
@ -83,11 +87,12 @@ function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShoul
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 11% /"
|
/dev/disk1 487219288 471466944 15496344 11% /"
|
||||||
}
|
}
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
|
||||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10
|
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10
|
||||||
|
|
||||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}11%% %k%F{yellow}%f " "$(build_left_prompt)"
|
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}11%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||||
@ -96,11 +101,12 @@ function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {
|
function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||||
df() {
|
df() {
|
||||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||||
/dev/disk1 487219288 471466944 15496344 11% /"
|
/dev/disk1 487219288 471466944 15496344 11% /"
|
||||||
}
|
}
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
|
||||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5
|
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5
|
||||||
local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10
|
local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIpSegmentPrintsNothingOnOsxIfNotConnected() {
|
function testIpSegmentPrintsNothingOnOsxIfNotConnected() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
||||||
alias networksetup='echo "not connected"'
|
alias networksetup='echo "not connected"'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
|
||||||
local OS="OSX" # Fake OSX
|
local OS="OSX" # Fake OSX
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
@ -23,8 +24,9 @@ function testIpSegmentPrintsNothingOnOsxIfNotConnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
||||||
alias ip='echo "not connected"'
|
alias ip='echo "not connected"'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
|
||||||
local OS="Linux" # Fake Linux
|
local OS="Linux" # Fake Linux
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
@ -34,7 +36,8 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
||||||
(1) Ethernet
|
(1) Ethernet
|
||||||
@ -69,7 +72,8 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
|||||||
# in hierarchical order, but from outside this is not obvious
|
# in hierarchical order, but from outside this is not obvious
|
||||||
# (implementation detail). So we need a test for this case.
|
# (implementation detail). So we need a test for this case.
|
||||||
function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
||||||
(1) Ethernet
|
(1) Ethernet
|
||||||
@ -116,7 +120,8 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||||
local OS='OSX' # Fake OSX
|
local OS='OSX' # Fake OSX
|
||||||
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
||||||
alias ipconfig="_(){ echo '1.2.3.4'; };_"
|
alias ipconfig="_(){ echo '1.2.3.4'; };_"
|
||||||
@ -155,7 +160,8 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
|
|||||||
|
|
||||||
function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
||||||
setopt aliases
|
setopt aliases
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
# That command is harder to test, as it is used at first
|
# That command is harder to test, as it is used at first
|
||||||
# to get all relevant network interfaces and then for
|
# to get all relevant network interfaces and then for
|
||||||
@ -185,7 +191,8 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
|
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||||
local OS='Linux' # Fake Linux
|
local OS='Linux' # Fake Linux
|
||||||
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
||||||
ip(){
|
ip(){
|
||||||
|
@ -12,7 +12,8 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias node="nonode 2>/dev/null"
|
alias node="nonode 2>/dev/null"
|
||||||
|
|
||||||
@ -23,7 +24,8 @@ function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeVersionSegmentWorks() {
|
function testNodeVersionSegmentWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version)
|
||||||
node() {
|
node() {
|
||||||
echo "v1.2.3"
|
echo "v1.2.3"
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeenvSegmentPrintsNothingWithoutNode() {
|
function testNodeenvSegmentPrintsNothingWithoutNode() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias node="nonode 2>/dev/null"
|
alias node="nonode 2>/dev/null"
|
||||||
|
|
||||||
@ -27,7 +28,8 @@ function testNodeenvSegmentPrintsNothingWithoutNode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {
|
function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
node() {
|
node() {
|
||||||
echo "v1.2.3"
|
echo "v1.2.3"
|
||||||
@ -39,7 +41,8 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() {
|
function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
node() {
|
node() {
|
||||||
echo "v1.2.3"
|
echo "v1.2.3"
|
||||||
@ -55,7 +58,8 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
|
function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)
|
||||||
alias node="nonode 2>/dev/null"
|
alias node="nonode 2>/dev/null"
|
||||||
NODE_VIRTUAL_ENV="node-env"
|
NODE_VIRTUAL_ENV="node-env"
|
||||||
|
|
||||||
@ -66,7 +70,8 @@ function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNodeenvSegmentWorks() {
|
function testNodeenvSegmentWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv)
|
||||||
node() {
|
node() {
|
||||||
echo "v1.2.3"
|
echo "v1.2.3"
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,16 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() {
|
function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm)
|
||||||
|
|
||||||
function nvm_version() {
|
function nvm_version() {
|
||||||
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'
|
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'
|
||||||
@ -49,7 +51,8 @@ function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {
|
function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
function nvm_version() {
|
function nvm_version() {
|
||||||
|
@ -12,7 +12,8 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias php="nophp"
|
alias php="nophp"
|
||||||
|
|
||||||
@ -22,7 +23,8 @@ function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPhpVersionSegmentWorks() {
|
function testPhpVersionSegmentWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version)
|
||||||
alias php="echo 'PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58)
|
alias php="echo 'PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58)
|
||||||
Copyright (c) 1997-2016 The PHP Group
|
Copyright (c) 1997-2016 The PHP Group
|
||||||
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
|
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
|
||||||
|
@ -36,7 +36,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {
|
function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world)
|
||||||
local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'
|
local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
# We need to overwrite dig, as this is a fallback method that
|
# We need to overwrite dig, as this is a fallback method that
|
||||||
@ -49,7 +50,8 @@ function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentPrintsNoticeIfNotConnected() {
|
function testPublicIpSegmentPrintsNoticeIfNotConnected() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'
|
local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz'
|
||||||
local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected"
|
local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected"
|
||||||
# We need to overwrite dig, as this is a fallback method that
|
# We need to overwrite dig, as this is a fallback method that
|
||||||
@ -62,7 +64,8 @@ function testPublicIpSegmentPrintsNoticeIfNotConnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentWorksWithWget() {
|
function testPublicIpSegmentWorksWithWget() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
alias dig='nodig'
|
alias dig='nodig'
|
||||||
alias curl='nocurl'
|
alias curl='nocurl'
|
||||||
wget() {
|
wget() {
|
||||||
@ -77,7 +80,8 @@ function testPublicIpSegmentWorksWithWget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {
|
function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
alias dig='nodig'
|
alias dig='nodig'
|
||||||
alias wget='nowget'
|
alias wget='nowget'
|
||||||
curl() {
|
curl() {
|
||||||
@ -92,7 +96,8 @@ function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable() {
|
function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
alias curl='nocurl'
|
alias curl='nocurl'
|
||||||
alias wget='nowget'
|
alias wget='nowget'
|
||||||
dig() {
|
dig() {
|
||||||
@ -107,7 +112,8 @@ function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentCachesFile() {
|
function testPublicIpSegmentCachesFile() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
dig() {
|
dig() {
|
||||||
echo "first"
|
echo "first"
|
||||||
}
|
}
|
||||||
@ -125,7 +131,8 @@ function testPublicIpSegmentCachesFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
local POWERLEVEL9K_PUBLIC_IP_TIMEOUT=2
|
local POWERLEVEL9K_PUBLIC_IP_TIMEOUT=2
|
||||||
dig() {
|
dig() {
|
||||||
echo "first"
|
echo "first"
|
||||||
@ -145,7 +152,8 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
dig() {
|
dig() {
|
||||||
echo "first"
|
echo "first"
|
||||||
}
|
}
|
||||||
@ -166,7 +174,8 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testPublicIpSegmentWhenGoingOnline() {
|
function testPublicIpSegmentWhenGoingOnline() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip)
|
||||||
local POWERLEVEL9K_PUBLIC_IP_METHODS="dig"
|
local POWERLEVEL9K_PUBLIC_IP_METHODS="dig"
|
||||||
local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected"
|
local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected"
|
||||||
alias dig="nodig"
|
alias dig="nodig"
|
||||||
|
@ -28,7 +28,6 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testRamSegmentWorksOnOsx() {
|
function testRamSegmentWorksOnOsx() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram)
|
|
||||||
local OS="OSX" # Fake OSX
|
local OS="OSX" # Fake OSX
|
||||||
alias vm_stat="echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes)
|
alias vm_stat="echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes)
|
||||||
Pages free: 299687.
|
Pages free: 299687.
|
||||||
@ -42,7 +41,6 @@ Pages inactive: 1313411.
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testRamSegmentWorksOnBsd() {
|
function testRamSegmentWorksOnBsd() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram)
|
|
||||||
local OS="BSD" # Fake BSD
|
local OS="BSD" # Fake BSD
|
||||||
mkdir -p var/run
|
mkdir -p var/run
|
||||||
echo "avail memory 5678B 299687 4444G 299" > var/run/dmesg.boot
|
echo "avail memory 5678B 299687 4444G 299" > var/run/dmesg.boot
|
||||||
@ -51,7 +49,6 @@ function testRamSegmentWorksOnBsd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testRamSegmentWorksOnLinux() {
|
function testRamSegmentWorksOnLinux() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram)
|
|
||||||
local OS="Linux" # Fake Linux
|
local OS="Linux" # Fake Linux
|
||||||
mkdir proc
|
mkdir proc
|
||||||
echo "MemAvailable: 299687" > proc/meminfo
|
echo "MemAvailable: 299687" > proc/meminfo
|
||||||
|
@ -16,7 +16,8 @@ function mockRust() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSshSegmentPrintsNothingIfNoSshConnection() {
|
function testSshSegmentPrintsNothingIfNoSshConnection() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo "world"'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo "world"'
|
||||||
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
||||||
# Weak test: Emulate No SSH connection by unsetting
|
# Weak test: Emulate No SSH connection by unsetting
|
||||||
@ -28,7 +29,8 @@ function testSshSegmentPrintsNothingIfNoSshConnection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSshSegmentWorksIfOnlySshClientIsSet() {
|
function testSshSegmentWorksIfOnlySshClientIsSet() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
||||||
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
||||||
# Weak test: Emulate No SSH connection by unsetting
|
# Weak test: Emulate No SSH connection by unsetting
|
||||||
# $SSH_CLIENT and $SSH_TTY
|
# $SSH_CLIENT and $SSH_TTY
|
||||||
@ -41,7 +43,8 @@ function testSshSegmentWorksIfOnlySshClientIsSet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSshSegmentWorksIfOnlySshTtyIsSet() {
|
function testSshSegmentWorksIfOnlySshTtyIsSet() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
||||||
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
||||||
# Weak test: Emulate No SSH connection by unsetting
|
# Weak test: Emulate No SSH connection by unsetting
|
||||||
# $SSH_CLIENT and $SSH_TTY
|
# $SSH_CLIENT and $SSH_TTY
|
||||||
@ -54,7 +57,8 @@ function testSshSegmentWorksIfOnlySshTtyIsSet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSshSegmentWorksIfAllNecessaryVariablesAreSet() {
|
function testSshSegmentWorksIfAllNecessaryVariablesAreSet() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh)
|
||||||
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
local POWERLEVEL9K_SSH_ICON="ssh-icon"
|
||||||
# Weak test: Emulate No SSH connection by unsetting
|
# Weak test: Emulate No SSH connection by unsetting
|
||||||
# $SSH_CLIENT and $SSH_TTY
|
# $SSH_CLIENT and $SSH_TTY
|
||||||
|
@ -17,8 +17,9 @@ function setUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
|
function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world)
|
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=false
|
local POWERLEVEL9K_STATUS_VERBOSE=false
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
|
|
||||||
@ -26,56 +27,63 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
|
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
|
||||||
|
|
||||||
assertEquals "%K{black} %F{green%}✔%f %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{green%}✔%f %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusInGeneralErrorCase() {
|
function testStatusInGeneralErrorCase() {
|
||||||
local RETVAL=1
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
|
local RETVAL=1
|
||||||
|
|
||||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)"
|
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPipestatusInErrorCase() {
|
function testPipestatusInErrorCase() {
|
||||||
local -a RETVALS
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
RETVALS=(0 0 1 0)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
|
||||||
|
local -a RETVALS
|
||||||
|
RETVALS=(0 0 1 0)
|
||||||
|
|
||||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}0|0|1|0 %k%F{red}%f " "$(build_left_prompt)"
|
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}0|0|1|0 %k%F{red}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusCrossWinsOverVerbose() {
|
function testStatusCrossWinsOverVerbose() {
|
||||||
local RETVAL=1
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_CROSS=true
|
local POWERLEVEL9K_STATUS_CROSS=true
|
||||||
|
local RETVAL=1
|
||||||
|
|
||||||
assertEquals "%K{black} %F{red%}✘%f %k%F{black}%f " "$(build_left_prompt)"
|
assertEquals "%K{black} %F{red%}✘%f %k%F{black}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusShowsSignalNameInErrorCase() {
|
function testStatusShowsSignalNameInErrorCase() {
|
||||||
local RETVAL=132
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
|
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
|
||||||
|
local RETVAL=132
|
||||||
|
|
||||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)"
|
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusSegmentIntegrated() {
|
function testStatusSegmentIntegrated() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
local POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
|
local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
||||||
|
|
||||||
false; powerlevel9k_prepare_prompts
|
false; powerlevel9k_prepare_prompts
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSwapSegmentWorksOnOsx() {
|
function testSwapSegmentWorksOnOsx() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
||||||
local OS="OSX" # Fake OSX
|
local OS="OSX" # Fake OSX
|
||||||
sysctl() {
|
sysctl() {
|
||||||
echo "vm.swapusage: total = 3072,00M used = 1620,50M free = 1451,50M (encrypted)"
|
echo "vm.swapusage: total = 3072,00M used = 1620,50M free = 1451,50M (encrypted)"
|
||||||
@ -40,7 +41,8 @@ function testSwapSegmentWorksOnOsx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSwapSegmentWorksOnLinux() {
|
function testSwapSegmentWorksOnLinux() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
||||||
local OS="Linux" # Fake Linux
|
local OS="Linux" # Fake Linux
|
||||||
mkdir proc
|
mkdir proc
|
||||||
echo "SwapTotal: 1000000" > proc/meminfo
|
echo "SwapTotal: 1000000" > proc/meminfo
|
||||||
|
@ -28,7 +28,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {
|
function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias swift="noswift"
|
alias swift="noswift"
|
||||||
|
|
||||||
@ -39,7 +40,8 @@ function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSwiftSegmentWorks() {
|
function testSwiftSegmentWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version)
|
||||||
function swift() {
|
function swift() {
|
||||||
echo "Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\nTarget: x86_64-apple-macosx10.9"
|
echo "Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\nTarget: x86_64-apple-macosx10.9"
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
alias php="nophp"
|
alias php="nophp"
|
||||||
|
|
||||||
@ -38,7 +39,8 @@ function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {
|
function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
||||||
# "Symfony" is not a command, but rather a framework.
|
# "Symfony" is not a command, but rather a framework.
|
||||||
# To sucessfully execute this test, we just need to
|
# To sucessfully execute this test, we just need to
|
||||||
# navigate into a folder that does not contain symfony.
|
# navigate into a folder that does not contain symfony.
|
||||||
@ -48,7 +50,8 @@ function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
mkdir app
|
mkdir app
|
||||||
touch app/AppKernel.php
|
touch app/AppKernel.php
|
||||||
@ -65,7 +68,8 @@ function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
|||||||
|
|
||||||
function testSymfonyVersionSegmentWorks() {
|
function testSymfonyVersionSegmentWorks() {
|
||||||
startSkipping # Skip test
|
startSkipping # Skip test
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)
|
||||||
mkdir app
|
mkdir app
|
||||||
touch app/AppKernel.php
|
touch app/AppKernel.php
|
||||||
|
|
||||||
@ -80,7 +84,8 @@ function testSymfonyVersionSegmentWorks() {
|
|||||||
|
|
||||||
function testSymfonyVersionSegmentWorksInNestedFolder() {
|
function testSymfonyVersionSegmentWorksInNestedFolder() {
|
||||||
startSkipping # Skip test
|
startSkipping # Skip test
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version)
|
||||||
mkdir app
|
mkdir app
|
||||||
touch app/AppKernel.php
|
touch app/AppKernel.php
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {
|
function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world)
|
||||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||||
|
|
||||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||||
@ -41,7 +42,8 @@ function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {
|
|||||||
|
|
||||||
function testTodoSegmentWorksAsExpected() {
|
function testTodoSegmentWorksAsExpected() {
|
||||||
# TODO: Skript in den PATH legen!
|
# TODO: Skript in den PATH legen!
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo)
|
||||||
echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh
|
echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh
|
||||||
echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh
|
echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh
|
||||||
chmod +x ${FOLDER}/bin/todo.sh
|
chmod +x ${FOLDER}/bin/todo.sh
|
||||||
|
@ -70,7 +70,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testColorOverridingForCleanStateWorks() {
|
function testColorOverridingForCleanStateWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
||||||
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
||||||
|
|
||||||
@ -78,7 +79,8 @@ function testColorOverridingForCleanStateWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testColorOverridingForModifiedStateWorks() {
|
function testColorOverridingForModifiedStateWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'
|
local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'
|
||||||
local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
|
local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
|
||||||
|
|
||||||
@ -91,7 +93,8 @@ function testColorOverridingForModifiedStateWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testColorOverridingForUntrackedStateWorks() {
|
function testColorOverridingForUntrackedStateWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan'
|
local POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan'
|
||||||
local POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
|
local POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
|
||||||
|
|
||||||
@ -108,7 +111,8 @@ function testGitIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testGitlabIconWorks() {
|
function testGitlabIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_GIT_GITLAB_ICON='GL-Icon'
|
local POWERLEVEL9K_VCS_GIT_GITLAB_ICON='GL-Icon'
|
||||||
|
|
||||||
# Add a GitLab project as remote origin. This is
|
# Add a GitLab project as remote origin. This is
|
||||||
@ -119,7 +123,8 @@ function testGitlabIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testBitbucketIconWorks() {
|
function testBitbucketIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='BB-Icon'
|
local POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='BB-Icon'
|
||||||
|
|
||||||
# Add a BitBucket project as remote origin. This is
|
# Add a BitBucket project as remote origin. This is
|
||||||
@ -130,7 +135,8 @@ function testBitbucketIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testGitHubIconWorks() {
|
function testGitHubIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_GIT_GITHUB_ICON='GH-Icon'
|
local POWERLEVEL9K_VCS_GIT_GITHUB_ICON='GH-Icon'
|
||||||
|
|
||||||
# Add a GitHub project as remote origin. This is
|
# Add a GitHub project as remote origin. This is
|
||||||
@ -141,7 +147,8 @@ function testGitHubIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testUntrackedFilesIconWorks() {
|
function testUntrackedFilesIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
|
local POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
|
||||||
|
|
||||||
# Create untracked file
|
# Create untracked file
|
||||||
@ -151,7 +158,8 @@ function testUntrackedFilesIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testStagedFilesIconWorks() {
|
function testStagedFilesIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_STAGED_ICON='+'
|
local POWERLEVEL9K_VCS_STAGED_ICON='+'
|
||||||
|
|
||||||
# Create staged file
|
# Create staged file
|
||||||
@ -165,7 +173,8 @@ function testStagedFilesIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testUnstagedFilesIconWorks() {
|
function testUnstagedFilesIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_UNSTAGED_ICON='M'
|
local POWERLEVEL9K_VCS_UNSTAGED_ICON='M'
|
||||||
|
|
||||||
# Create unstaged (modified, but not added to index) file
|
# Create unstaged (modified, but not added to index) file
|
||||||
@ -178,7 +187,8 @@ function testUnstagedFilesIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testStashIconWorks() {
|
function testStashIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_STASH_ICON='S'
|
local POWERLEVEL9K_VCS_STASH_ICON='S'
|
||||||
|
|
||||||
# Create modified file
|
# Create modified file
|
||||||
@ -192,7 +202,8 @@ function testStashIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testTagIconWorks() {
|
function testTagIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
||||||
|
|
||||||
touch "file.txt"
|
touch "file.txt"
|
||||||
@ -204,7 +215,8 @@ function testTagIconWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testTagIconInDetachedHeadState() {
|
function testTagIconInDetachedHeadState() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
||||||
|
|
||||||
touch "file.txt"
|
touch "file.txt"
|
||||||
@ -221,7 +233,8 @@ function testTagIconInDetachedHeadState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testActionHintWorks() {
|
function testActionHintWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
|
|
||||||
touch "i-am-modified.txt"
|
touch "i-am-modified.txt"
|
||||||
git add i-am-modified.txt
|
git add i-am-modified.txt
|
||||||
@ -240,7 +253,8 @@ function testActionHintWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIncomingHintWorks() {
|
function testIncomingHintWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='I'
|
local POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='I'
|
||||||
|
|
||||||
touch "i-am-modified.txt"
|
touch "i-am-modified.txt"
|
||||||
@ -258,7 +272,8 @@ function testIncomingHintWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testOutgoingHintWorks() {
|
function testOutgoingHintWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='o'
|
local POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='o'
|
||||||
|
|
||||||
touch "i-am-modified.txt"
|
touch "i-am-modified.txt"
|
||||||
@ -276,7 +291,8 @@ function testOutgoingHintWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testShorteningCommitHashWorks() {
|
function testShorteningCommitHashWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_SHOW_CHANGESET=true
|
local POWERLEVEL9K_SHOW_CHANGESET=true
|
||||||
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
||||||
|
|
||||||
@ -292,7 +308,8 @@ function testShorteningCommitHashWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_SHOW_CHANGESET=false
|
local POWERLEVEL9K_SHOW_CHANGESET=false
|
||||||
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@ function tearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testColorOverridingForCleanStateWorks() {
|
function testColorOverridingForCleanStateWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
||||||
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
||||||
|
|
||||||
@ -42,7 +43,8 @@ function testColorOverridingForCleanStateWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testColorOverridingForModifiedStateWorks() {
|
function testColorOverridingForModifiedStateWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'
|
local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red'
|
||||||
local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
|
local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
|
||||||
|
|
||||||
@ -60,7 +62,8 @@ function testColorOverridingForModifiedStateWorks() {
|
|||||||
# This may be improved in future versions, to be a bit more consistent with
|
# This may be improved in future versions, to be a bit more consistent with
|
||||||
# the git part.
|
# the git part.
|
||||||
function testAddedFilesIconWorks() {
|
function testAddedFilesIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
touch "myfile.txt"
|
touch "myfile.txt"
|
||||||
hg add myfile.txt
|
hg add myfile.txt
|
||||||
|
|
||||||
@ -70,7 +73,8 @@ function testAddedFilesIconWorks() {
|
|||||||
# We don't support tagging in mercurial right now..
|
# We don't support tagging in mercurial right now..
|
||||||
function testTagIconWorks() {
|
function testTagIconWorks() {
|
||||||
startSkipping # Skip test
|
startSkipping # Skip test
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
||||||
|
|
||||||
touch "file.txt"
|
touch "file.txt"
|
||||||
@ -83,7 +87,8 @@ function testTagIconWorks() {
|
|||||||
|
|
||||||
function testTagIconInDetachedHeadState() {
|
function testTagIconInDetachedHeadState() {
|
||||||
startSkipping # Skip test
|
startSkipping # Skip test
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
local POWERLEVEL9K_VCS_TAG_ICON='T'
|
||||||
|
|
||||||
touch "file.txt"
|
touch "file.txt"
|
||||||
@ -100,7 +105,8 @@ function testTagIconInDetachedHeadState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testActionHintWorks() {
|
function testActionHintWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
touch "i-am-modified.txt"
|
touch "i-am-modified.txt"
|
||||||
hg add i-am-modified.txt
|
hg add i-am-modified.txt
|
||||||
hg commit -m "Add File" &>/dev/null
|
hg commit -m "Add File" &>/dev/null
|
||||||
@ -119,7 +125,8 @@ function testActionHintWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testShorteningCommitHashWorks() {
|
function testShorteningCommitHashWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_SHOW_CHANGESET=true
|
local POWERLEVEL9K_SHOW_CHANGESET=true
|
||||||
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
||||||
|
|
||||||
@ -136,7 +143,8 @@ function testShorteningCommitHashWorks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_SHOW_CHANGESET=false
|
local POWERLEVEL9K_SHOW_CHANGESET=false
|
||||||
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4'
|
||||||
|
|
||||||
@ -152,14 +160,16 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testMercurialIconWorks() {
|
function testMercurialIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_HG_ICON='HG-Icon'
|
local POWERLEVEL9K_VCS_HG_ICON='HG-Icon'
|
||||||
|
|
||||||
assertEquals "%K{green} %F{black%}HG-Icon %f%F{black} default %k%F{green}%f " "$(build_left_prompt)"
|
assertEquals "%K{green} %F{black%}HG-Icon %f%F{black} default %k%F{green}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBookmarkIconWorks() {
|
function testBookmarkIconWorks() {
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
local POWERLEVEL9K_VCS_BOOKMARK_ICON='B'
|
local POWERLEVEL9K_VCS_BOOKMARK_ICON='B'
|
||||||
hg bookmark "initial"
|
hg bookmark "initial"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user