Merge branch 'fix_colors' into prepare_066

pull/22/head
Dominik Ritter 6 years ago
commit e0630d7573

@ -172,7 +172,7 @@ left_prompt_segment() {
# Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable "${foregroundColor}"
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
visual_identifier="$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}%f"
fi
fi
@ -189,7 +189,7 @@ left_prompt_segment() {
# End the left prompt, closes the final segment.
left_prompt_end() {
if [[ -n $CURRENT_BG ]]; then
echo -n "%k%F{$CURRENT_BG}$(print_icon 'LEFT_SEGMENT_SEPARATOR')"
echo -n "%k$(foregroundColor ${CURRENT_BG})$(print_icon 'LEFT_SEGMENT_SEPARATOR')"
else
echo -n "%k"
fi
@ -274,7 +274,7 @@ right_prompt_segment() {
# Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable "${foregroundColor}"
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
visual_identifier="$(foregroundColor ${(P)visual_identifier_color_variable})${visual_identifier}%f"
fi
fi

@ -16,7 +16,7 @@ function testDynamicColoringOfSegmentsWork() {
local POWERLEVEL9K_DATE_ICON="date-icon"
local POWERLEVEL9K_DATE_BACKGROUND='red'
assertEquals "%K{009} %F{000%}date-icon %f%F{000}%D{%d.%m.%y} %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{000}date-icon %f%F{000}%D{%d.%m.%y} %k%F{009}%f " "$(build_left_prompt)"
}
function testDynamicColoringOfVisualIdentifiersWork() {
@ -24,7 +24,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
local POWERLEVEL9K_DATE_ICON="date-icon"
local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green'
assertEquals "%K{015} %F{green%}date-icon %f%F{000}%D{%d.%m.%y} %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{015}%f " "$(build_left_prompt)"
}
function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
@ -34,7 +34,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
local POWERLEVEL9K_DATE_FOREGROUND='red'
local POWERLEVEL9K_DATE_BACKGROUND='yellow'
assertEquals "%K{011} %F{green%}date-icon %f%F{009}%D{%d.%m.%y} %k%F{011}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{002}date-icon %f%F{009}%D{%d.%m.%y} %k%F{011}%f " "$(build_left_prompt)"
}
function testColorOverridingOfStatefulSegment() {
@ -45,7 +45,7 @@ function testColorOverridingOfStatefulSegment() {
# Provoke state
local SSH_CLIENT="x"
assertEquals "%K{009} %F{002%}ssh-icon %f%F{002}%m %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{002}ssh-icon %f%F{002}%m %k%F{009}%f " "$(build_left_prompt)"
}
function testColorOverridingOfCustomSegment() {
@ -56,7 +56,7 @@ function testColorOverridingOfCustomSegment() {
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND='red'
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND='red'
assertEquals "%K{009} %F{green%}CW %f%F{009}world %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{002}CW %f%F{009}world %k%F{009}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -18,7 +18,7 @@ function testOverwritingIconsWork() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%K{015} %F{000%}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
}
function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
@ -27,7 +27,7 @@ function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%K{015} %F{000%}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
}
function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
@ -36,7 +36,7 @@ function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%F{015}%f%K{015}%F{000} world1%F{000%} icon-here%f%E" "$(build_right_prompt)"
assertEquals "%F{015}%f%K{015}%F{000} world1%F{000} icon-here%f%E" "$(build_right_prompt)"
}
function testVisualIdentifierPrintsNothingIfNotAvailable() {
@ -47,4 +47,14 @@ function testVisualIdentifierPrintsNothingIfNotAvailable() {
assertEquals "%K{015} %F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
}
function testVisualIdentifierIsPrintedInNumericalColorCode() {
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON="xxx"
local POWERLEVEL9K_CUSTOM_WORLD1_VISUAL_IDENTIFIER_COLOR="purple3"
assertEquals "%K{015} %F{056}xxx %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
cd /tmp
assertEquals "%K{012} %F{green%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{002}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
cd -
}
@ -84,7 +84,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
cd /tmp
assertEquals "%K{011} %F{green%}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{002}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)"
cd -
}
@ -100,7 +100,7 @@ function testOverwritingIconsWork() {
#cd ~/$testFolder
cd /tmp
assertEquals "%K{012} %F{000%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
cd -
# rm -fr ~/$testFolder

@ -35,7 +35,7 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
CONDA_ENV_PATH=/tmp
unset CONDA_PREFIX
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(tmp) %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}icon-here %f%F{000}(tmp) %k%F{012}%f " "$(build_left_prompt)"
}
function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
@ -49,7 +49,7 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
unset CONDA_ENV_PATH
local CONDA_PREFIX="test"
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(test) %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}icon-here %f%F{000}(test) %k%F{012}%f " "$(build_left_prompt)"
}
function testAnacondaSegmentWorks() {
@ -63,7 +63,7 @@ function testAnacondaSegmentWorks() {
local CONDA_ENV_PATH=/tmp
local CONDA_PREFIX="test"
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(tmptest) %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}icon-here %f%F{000}(tmptest) %k%F{012}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -31,7 +31,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
cd /tmp/powerlevel9k-test
assertEquals "%K{000} %F{002%}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
rm -fr /tmp/powerlevel9k-test
cd -
@ -52,7 +52,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
cd /tmp/powerlevel9k-test/1/12/123/1234/12345
assertEquals "%K{000} %F{002%}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
rm -fr /tmp/powerlevel9k-test
cd -

@ -34,7 +34,7 @@ function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{014%}⚙%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{014}⚙%f %k%F{000}%f " "$(build_left_prompt)"
unfunction jobs
}
@ -52,7 +52,7 @@ function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{014%}⚙%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{014}⚙%f %k%F{000}%f " "$(build_left_prompt)"
unfunction jobs
}
@ -70,7 +70,7 @@ function testBackgroundJobsSegmentWithVerboseMode() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{014%}⚙ %f%F{014}3 %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{014}⚙ %f%F{014}3 %k%F{000}%f " "$(build_left_prompt)"
unfunction jobs
}

@ -69,7 +69,7 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
makeBatterySay "Now drawing from 'Battery Power'
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{009}🔋 %f%F{009}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
@ -77,7 +77,7 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
makeBatterySay "Now drawing from 'Battery Power'
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{011}🔋 %f%F{011}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
@ -85,7 +85,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
makeBatterySay "Now drawing from 'Battery Power'
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
assertEquals "%K{000} %F{015%}🔋 %f%F{015}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{015}🔋 %f%F{015}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
@ -93,7 +93,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
makeBatterySay "Now drawing from 'Battery Power'
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
assertEquals "%K{000} %F{011%}🔋 %f%F{011}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{011}🔋 %f%F{011}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsFullOnOSX() {
@ -101,7 +101,7 @@ function testBatterySegmentIfBatteryIsFullOnOSX() {
makeBatterySay "Now drawing from 'AC Power'
-InternalBattery-0 (id=1234567) 99%; charged; 0:00 remaining present: true"
assertEquals "%K{000} %F{002%}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{002}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
@ -109,42 +109,42 @@ function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
makeBatterySay "Now drawing from 'Battery Power'
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
assertEquals "%K{000} %F{015%}🔋 %f%F{015}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{015}🔋 %f%F{015}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
local OS='Linux' # Fake Linux
makeBatterySay "4" "Discharging"
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{009}🔋 %f%F{009}4%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
local OS='Linux' # Fake Linux
makeBatterySay "4" "Charging"
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{011}🔋 %f%F{011}4%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
local OS='Linux' # Fake Linux
makeBatterySay "10" "Discharging"
assertEquals "%K{000} %F{015%}🔋 %f%F{015}10%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{015}🔋 %f%F{015}10%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
local OS='Linux' # Fake Linux
makeBatterySay "10" "Charging"
assertEquals "%K{000} %F{011%}🔋 %f%F{011}10%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{011}🔋 %f%F{011}10%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsFullOnLinux() {
local OS='Linux' # Fake Linux
makeBatterySay "100" "Full"
assertEquals "%K{000} %F{002%}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{002}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})"
}
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
@ -155,7 +155,7 @@ function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
# For running on Mac, we need to mock date :(
[[ -f /usr/local/bin/gdate ]] && alias date=gdate
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{015}🔋 %f%F{015}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
unalias date &>/dev/null
# unaliasing date fails where it was never aliased (e.g. on Linux).
@ -171,7 +171,7 @@ function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
chmod +x ${FOLDER}/usr/bin/acpi
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
assertEquals "%K{000} %F{015}🔋 %f%F{015}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
}
source shunit2/shunit2

@ -34,7 +34,7 @@ function testCommandExecutionTimeThresholdCouldBeChanged() {
# Override payload
local _P9K_COMMAND_DURATION=2.03
assertEquals "%K{009} %F{226%}Dur %f%F{226}2.03 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}2.03 %k%F{009}%f " "$(build_left_prompt)"
}
function testCommandExecutionTimeThresholdCouldBeSetToZero() {
@ -43,7 +43,7 @@ function testCommandExecutionTimeThresholdCouldBeSetToZero() {
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
local _P9K_COMMAND_DURATION=0.03
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.03 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}0.03 %k%F{009}%f " "$(build_left_prompt)"
}
function testCommandExecutionTimePrecisionCouldBeChanged() {
@ -58,7 +58,7 @@ function testCommandExecutionTimePrecisionCouldBeChanged() {
# Override payload
local _P9K_COMMAND_DURATION=0.0001
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.0001 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}0.0001 %k%F{009}%f " "$(build_left_prompt)"
}
function testCommandExecutionTimePrecisionCouldBeSetToZero() {
@ -72,7 +72,7 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
# Override payload
local _P9K_COMMAND_DURATION=23.5001
assertEquals "%K{009} %F{226%}Dur %f%F{226}23 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}23 %k%F{009}%f " "$(build_left_prompt)"
}
function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand() {
@ -85,7 +85,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand()
# Override payload
local _P9K_COMMAND_DURATION=180
assertEquals "%K{009} %F{226%}Dur %f%F{226}03:00 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}03:00 %k%F{009}%f " "$(build_left_prompt)"
}
function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
@ -98,7 +98,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
# Override payload
local _P9K_COMMAND_DURATION=7200
assertEquals "%K{009} %F{226%}Dur %f%F{226}02:00:00 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}Dur %f%F{226}02:00:00 %k%F{009}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -67,7 +67,7 @@ function testSettingVisualIdentifierForCustomSegment() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{015} %F{000%}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
}
function testSettingVisualIdentifierForegroundColorForCustomSegment() {
@ -80,7 +80,7 @@ function testSettingVisualIdentifierForegroundColorForCustomSegment() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{015} %F{red%}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{009}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -352,7 +352,7 @@ function testHomeFolderDetectionWorks() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
cd ~
assertEquals "%K{012} %F{000%}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
cd -
}
@ -368,7 +368,7 @@ function testHomeSubfolderDetectionWorks() {
local FOLDER=~/powerlevel9k-test
mkdir $FOLDER
cd $FOLDER
assertEquals "%K{012} %F{000%}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $FOLDER
@ -385,7 +385,7 @@ function testOtherFolderDetectionWorks() {
local FOLDER=/tmp/powerlevel9k-test
mkdir $FOLDER
cd $FOLDER
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $FOLDER
@ -462,7 +462,7 @@ function testOmittingFirstCharacterWorks() {
cd /tmp
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
cd -
}
@ -480,7 +480,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test

@ -40,7 +40,7 @@ function testDiskUsageSegmentWhenDiskIsAlmostFull() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{009} %F{015%}hdd %f%F{015}97%% %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{015}hdd %f%F{015}97%% %k%F{009}%f " "$(build_left_prompt)"
unfunction df
}
@ -56,7 +56,7 @@ function testDiskUsageSegmentWhenDiskIsVeryFull() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{011} %F{000%}hdd %f%F{000}94%% %k%F{011}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{000}hdd %f%F{000}94%% %k%F{011}%f " "$(build_left_prompt)"
unfunction df
}
@ -72,7 +72,7 @@ function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{000} %F{011%}hdd %f%F{011}4%% %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{011}hdd %f%F{011}4%% %k%F{000}%f " "$(build_left_prompt)"
unfunction df
}
@ -105,7 +105,7 @@ function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{011} %F{000%}hdd %f%F{000}11%% %k%F{011}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{000}hdd %f%F{000}11%% %k%F{011}%f " "$(build_left_prompt)"
unfunction df
}
@ -123,7 +123,7 @@ function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{009} %F{015%}hdd %f%F{015}11%% %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{015}hdd %f%F{015}11%% %k%F{009}%f " "$(build_left_prompt)"
unfunction df
}

@ -42,7 +42,7 @@ function testGo() {
local PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
assertEquals "%K{002} %F{255%} %f%F{255}go1.5.3 %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{255} %f%F{255}go1.5.3 %k%F{002}%f " "$(build_left_prompt)"
unalias go
}

@ -68,7 +68,7 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
source powerlevel9k.zsh-theme
local OS='OSX' # Fake OSX
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
unalias ipconfig
unalias networksetup
@ -123,7 +123,7 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
source powerlevel9k.zsh-theme
local OS='OSX' # Fake OSX
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
unfunction ipconfig
unalias networksetup
@ -139,7 +139,7 @@ function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
source powerlevel9k.zsh-theme
local OS='OSX' # Fake OSX
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
unalias ipconfig
}
@ -169,7 +169,7 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
source powerlevel9k.zsh-theme
local OS='Linux' # Fake Linux
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
unfunction ip
}
@ -204,7 +204,7 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
source powerlevel9k.zsh-theme
local OS='Linux' # Fake Linux
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
unfunction ip
}
@ -223,7 +223,7 @@ inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
source powerlevel9k.zsh-theme
local OS='Linux' # Fake Linux
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
assertEquals "%K{014} %F{000}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
unfunction ip
}

@ -71,7 +71,7 @@ function testKubeContext() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/default %k%F{013}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{015}⎈ %f%F{015}minikube/default %k%F{013}%f " "$(build_left_prompt)"
unalias kubectl
}
@ -83,7 +83,7 @@ function testKubeContextOtherNamespace() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/kube-system %k%F{013}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{015}⎈ %f%F{015}minikube/kube-system %k%F{013}%f " "$(build_left_prompt)"
unalias kubectl
}

@ -34,7 +34,7 @@ function testLaravelVersionSegment() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{001} %F{015%}x %f%F{015}5.4.23 %k%F{001}%f " "$(build_left_prompt)"
assertEquals "%K{001} %F{015}x %f%F{015}5.4.23 %k%F{001}%f " "$(build_left_prompt)"
unalias php
}

@ -42,7 +42,7 @@ function testLoadSegmentWorksOnOsx() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="OSX" # Fake OSX
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
unfunction sysctl
}
@ -64,7 +64,7 @@ function testLoadSegmentWorksOnBsd() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="BSD" # Fake BSD
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
unfunction sysctl
}
@ -81,7 +81,7 @@ function testLoadSegmentWorksOnLinux() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{002} %F{000}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
unalias nproc
}
@ -101,7 +101,7 @@ function testLoadSegmentNormalState() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{002} %F{000%}L %f%F{000}1.00 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{002} %F{000}L %f%F{000}1.00 " "$(prompt_load left 1 false ${FOLDER})"
unalias nproc
}
@ -121,7 +121,7 @@ function testLoadSegmentWarningState() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{011} %F{000%}L %f%F{000}2.01 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}L %f%F{000}2.01 " "$(prompt_load left 1 false ${FOLDER})"
unalias nproc
}
@ -141,7 +141,7 @@ function testLoadSegmentCriticalState() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{009} %F{000%}L %f%F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})"
assertEquals "%K{009} %F{000}L %f%F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})"
unalias nproc
}

@ -33,7 +33,7 @@ function testNodeVersionSegmentWorks() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{002} %F{015%}⬢ %f%F{015}1.2.3 %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{015}⬢ %f%F{015}1.2.3 %k%F{002}%f " "$(build_left_prompt)"
unfunction node
}

@ -73,7 +73,7 @@ function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{002%}⬢ %f%F{002}[node-env] %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002}⬢ %f%F{002}[node-env] %k%F{000}%f " "$(build_left_prompt)"
unset NODE_VIRTUAL_ENV
unalias node
@ -90,7 +90,7 @@ function testNodeenvSegmentWorks() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{002%}⬢ %f%F{002}v1.2.3[node-env] %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002}⬢ %f%F{002}v1.2.3[node-env] %k%F{000}%f " "$(build_left_prompt)"
unfunction node
unset NODE_VIRTUAL_ENV

@ -51,7 +51,7 @@ function testNvmSegmentWorksWithoutHavingADefaultAlias() {
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'
}
assertEquals "%K{013} %F{000%}⬢ %f%F{000}4.6.0 %k%F{013}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{000}⬢ %f%F{000}4.6.0 %k%F{013}%f " "$(build_left_prompt)"
}
function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {

@ -36,7 +36,7 @@ Pages inactive: 1313411.
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="OSX" # Fake OSX
assertEquals "%K{011} %F{000%}RAM %f%F{000}6.15G " "$(prompt_ram left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}RAM %f%F{000}6.15G " "$(prompt_ram left 1 false ${FOLDER})"
unalias vm_stat
}
@ -49,7 +49,7 @@ function testRamSegmentWorksOnBsd() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="BSD" # Fake BSD
assertEquals "%K{011} %F{000%}RAM %f%F{000}0.29M " "$(prompt_ram left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}RAM %f%F{000}0.29M " "$(prompt_ram left 1 false ${FOLDER})"
}
function testRamSegmentWorksOnLinux() {
@ -60,7 +60,7 @@ function testRamSegmentWorksOnLinux() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{011} %F{000%}RAM %f%F{000}0.29G " "$(prompt_ram left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}RAM %f%F{000}0.29G " "$(prompt_ram left 1 false ${FOLDER})"
}
source shunit2/shunit2

@ -34,7 +34,7 @@ function testRust() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{208} %F{000%}Rust %f%F{000}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)"
assertEquals "%K{208} %F{000}Rust %f%F{000}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)"
}
function testRustPrintsNothingIfRustIsNotAvailable() {

@ -37,7 +37,7 @@ function testSshSegmentWorksIfOnlySshClientIsSet() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{011}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
unset SSH_CLIENT
}
@ -54,7 +54,7 @@ function testSshSegmentWorksIfOnlySshTtyIsSet() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{011}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
unset SSH_TTY
}
@ -71,7 +71,7 @@ function testSshSegmentWorksIfAllNecessaryVariablesAreSet() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{011}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
unset SSH_TTY
unset SSH_CLIENT

@ -37,7 +37,7 @@ function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
# Load Powerlevel9k
source powerlevel9k.zsh-theme
assertEquals "%K{000} %F{002%}✔%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002}✔%f %k%F{000}%f " "$(build_left_prompt)"
}
function testStatusInGeneralErrorCase() {
@ -50,7 +50,7 @@ function testStatusInGeneralErrorCase() {
source powerlevel9k.zsh-theme
local RETVAL=1
assertEquals "%K{009} %F{226%}↵ %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}↵ %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
}
function testPipestatusInErrorCase() {
@ -64,7 +64,7 @@ function testPipestatusInErrorCase() {
local -a RETVALS
RETVALS=(0 0 1 0)
assertEquals "%K{009} %F{226%}↵ %f%F{226}0|0|1|0 %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}↵ %f%F{226}0|0|1|0 %k%F{009}%f " "$(build_left_prompt)"
}
function testStatusCrossWinsOverVerbose() {
@ -78,7 +78,7 @@ function testStatusCrossWinsOverVerbose() {
source powerlevel9k.zsh-theme
local RETVAL=1
assertEquals "%K{000} %F{009%}✘%f %k%F{000}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{009}✘%f %k%F{000}%f " "$(build_left_prompt)"
}
function testStatusShowsSignalNameInErrorCase() {
@ -92,7 +92,7 @@ function testStatusShowsSignalNameInErrorCase() {
source powerlevel9k.zsh-theme
local RETVAL=132
assertEquals "%K{009} %F{226%}↵ %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226}↵ %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
}
function testStatusSegmentIntegrated() {
@ -107,7 +107,7 @@ function testStatusSegmentIntegrated() {
false; powerlevel9k_prepare_prompts
assertEquals "%f%b%k%K{000} %F{009%}✘%f %k%F{000}%f " "${(e)PROMPT}"
assertEquals "%f%b%k%K{000} %F{009}✘%f %k%F{000}%f " "${(e)PROMPT}"
}
source shunit2/shunit2

@ -36,7 +36,7 @@ function testSwapSegmentWorksOnOsx() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="OSX" # Fake OSX
assertEquals "%K{011} %F{000%}SWP %f%F{000}1.58G " "$(prompt_swap left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}SWP %f%F{000}1.58G " "$(prompt_swap left 1 false ${FOLDER})"
unfunction sysctl
}
@ -52,7 +52,7 @@ function testSwapSegmentWorksOnLinux() {
source ${P9K_HOME}/powerlevel9k.zsh-theme
local OS="Linux" # Fake Linux
assertEquals "%K{011} %F{000%}SWP %f%F{000}0.95G " "$(prompt_swap left 1 false ${FOLDER})"
assertEquals "%K{011} %F{000}SWP %f%F{000}0.95G " "$(prompt_swap left 1 false ${FOLDER})"
}
source shunit2/shunit2

@ -49,7 +49,7 @@ function testSwiftSegmentWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{013} %F{015%}Swift %f%F{015}3.0.1 %k%F{013}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{015}Swift %f%F{015}3.0.1 %k%F{013}%f " "$(build_left_prompt)"
unfunction swift
}

@ -87,7 +87,7 @@ function testSymfonyVersionSegmentWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{240} %F{000%}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
assertEquals "%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
unfunction php
}
@ -109,7 +109,7 @@ function testSymfonyVersionSegmentWorksInNestedFolder() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{240} %F{000%}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
assertEquals "%K{240} %F{000}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
unfunction php
}

@ -52,7 +52,7 @@ function testTodoSegmentWorksAsExpected() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{244} %F{000%}☑ %f%F{000}100 %k%F{244}%f " "$(build_left_prompt)"
assertEquals "%K{244} %F{000}☑ %f%F{000}100 %k%F{244}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

@ -117,7 +117,7 @@ function testGitIconWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{002} %F{000%}Git-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000}Git-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
}
function testGitlabIconWorks() {
@ -132,7 +132,7 @@ function testGitlabIconWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{002} %F{000%}GL-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000}GL-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
}
function testBitbucketIconWorks() {
@ -147,7 +147,7 @@ function testBitbucketIconWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{002} %F{000%}BB-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000}BB-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
}
function testGitHubIconWorks() {
@ -162,7 +162,7 @@ function testGitHubIconWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{002} %F{000%}GH-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000}GH-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
}
function testUntrackedFilesIconWorks() {

@ -189,7 +189,7 @@ function testMercurialIconWorks() {
# Load Powerlevel9k
source ${P9K_HOME}/powerlevel9k.zsh-theme
assertEquals "%K{002} %F{000%}HG-Icon %f%F{000} default %k%F{002}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000}HG-Icon %f%F{000} default %k%F{002}%f " "$(build_left_prompt)"
}
function testBookmarkIconWorks() {

Loading…
Cancel
Save