mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
Prepare tests for performance optimizations
This commit is contained in:
parent
99f0eddd62
commit
06de83cc0f
31 changed files with 645 additions and 117 deletions
|
@ -7,14 +7,16 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Unset anacona variables
|
||||
unset CONDA_ENV_PATH
|
||||
unset CONDA_PREFIX
|
||||
|
@ -23,34 +25,45 @@ function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
|||
}
|
||||
|
||||
function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
||||
CONDA_ENV_PATH=/tmp
|
||||
unset CONDA_PREFIX
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
CONDA_ENV_PATH=/tmp
|
||||
unset CONDA_PREFIX
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmp) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
||||
unset CONDA_ENV_PATH
|
||||
local CONDA_PREFIX="test"
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
unset CONDA_ENV_PATH
|
||||
local CONDA_PREFIX="test"
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(test) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAnacondaSegmentWorks() {
|
||||
local CONDA_ENV_PATH=/tmp
|
||||
local CONDA_PREFIX="test"
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda)
|
||||
local POWERLEVEL9K_PYTHON_ICON="icon-here"
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
local CONDA_ENV_PATH=/tmp
|
||||
local CONDA_PREFIX="test"
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/source/2.1/src/shunit2
|
|
@ -7,24 +7,30 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() {
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world)
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk
|
||||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
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)"
|
||||
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -35,14 +41,17 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec
|
|||
# Skip test, because currently we cannot detect
|
||||
# if the configuration is in a parent directory
|
||||
startSkipping # Skip test
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk
|
||||
mkdir -p /tmp/powerlevel9k-test/1/12/123/1234/12345
|
||||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||
cd /tmp/powerlevel9k-test/1/12/123/1234/12345
|
||||
|
||||
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)"
|
||||
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
||||
|
@ -17,6 +15,9 @@ function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world)
|
||||
alias jobs="nojobs 2>/dev/null"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias jobs
|
||||
|
@ -30,6 +31,9 @@ function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
|
|||
echo '[1] + 30444 suspended nvim xx'
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
|
@ -45,6 +49,9 @@ function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
|
|||
echo "[3] + 31206 suspended nvim xx3"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
|
@ -60,6 +67,9 @@ function testBackgroundJobsSegmentWithVerboseMode() {
|
|||
echo "[3] + 31206 suspended nvim xx3"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙ %f%F{cyan}3 %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
|
|
|
@ -37,6 +37,7 @@ function tearDown() {
|
|||
unset PMSET_PATH
|
||||
unset BATTERY_PATH
|
||||
unset FOLDER
|
||||
unset P9K_HOME
|
||||
}
|
||||
|
||||
# Mock Battery
|
||||
|
|
|
@ -7,14 +7,17 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world command_execution_time)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=2
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
@ -24,6 +27,11 @@ function testCommandExecutionTimeThresholdCouldBeChanged() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=2.03
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}2.03 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -43,6 +51,11 @@ function testCommandExecutionTimePrecisionCouldBeChanged() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
|
||||
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=0.0001
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.0001 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -52,6 +65,11 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=23.5001
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}23 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -60,6 +78,11 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
|
|||
function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=180
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}03:00 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -68,6 +91,11 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand()
|
|||
function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=7200
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}02:00:00 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Test specific settings
|
||||
OLD_DEFAULT_USER=$DEFAULT_USER
|
||||
|
@ -26,6 +24,9 @@ function testContextSegmentDoesNotGetRenderedWithDefaultUser() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -34,6 +35,9 @@ function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -41,14 +45,20 @@ function testContextSegmentWithForeignUser() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
# TODO: How to test root?
|
||||
function testContextSegmentWithRootUser() {
|
||||
startSkipping # Skip test
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||
startSkipping # Skip test
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
@ -58,6 +68,9 @@ function testOverridingContextTemplate() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
|
||||
local POWERLEVEL9K_CONTEXT_TEMPLATE=xx
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -67,6 +80,9 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
|||
local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
|
||||
local DEFAULT_USER=$(whoami)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -76,6 +92,9 @@ function testContextSegmentIsShownIfForced() {
|
|||
local POWERLEVEL9K_ALWAYS_SHOW_USER=true
|
||||
local DEFAULT_USER=$(whoami)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}$(whoami) %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testCustomDirectOutputSegment() {
|
||||
|
@ -16,6 +14,9 @@ function testCustomDirectOutputSegment() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -26,6 +27,9 @@ function testCustomClosureSegment() {
|
|||
echo "world"
|
||||
}
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='p9k_hello_world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
@ -36,6 +40,9 @@ function testSettingBackgroundForCustomSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND="yellow"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black}world %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -45,6 +52,9 @@ function testSettingForegroundForCustomSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND="red"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{red}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -54,6 +64,9 @@ function testSettingVisualIdentifierForCustomSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD="echo world"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black%}hw %f%F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -64,6 +77,9 @@ function testSettingVisualIdentifierForegroundColorForCustomSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR="red"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{red%}hw %f%F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias systemd-detect-virt="novirt"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias systemd-detect-virt
|
||||
|
@ -27,6 +30,9 @@ function testDetectVirtSegmentIfSystemdReturnsPlainName() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt)
|
||||
alias systemd-detect-virt="echo 'xxx'"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}xxx %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias systemd-detect-virt
|
||||
|
@ -40,6 +46,9 @@ function testDetectVirtSegmentIfRootFsIsOnExpectedInode() {
|
|||
# directory having the inode number "2"..
|
||||
alias systemd-detect-virt="echo 'none'"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# The original command in the implementation is "ls -di / | grep -o 2",
|
||||
# which translates to: Show the inode number of "/" and test if it is "2".
|
||||
alias ls="echo '2'"
|
||||
|
@ -58,6 +67,9 @@ function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() {
|
|||
# directory having the inode number "2"..
|
||||
alias systemd-detect-virt="echo 'none'"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# The original command in the implementation is "ls -di / | grep -o 2",
|
||||
# which translates to: Show the inode number of "/" and test if it is "2".
|
||||
alias ls="echo '3'"
|
||||
|
|
|
@ -7,8 +7,12 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME="${PWD}"
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset P9K_HOME
|
||||
}
|
||||
|
||||
function testDirPathAbsoluteWorks() {
|
||||
|
@ -16,6 +20,9 @@ function testDirPathAbsoluteWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_ABSOLUTE=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
|
||||
# Unfortunately, we cannot fake Linux or OSX here, because
|
||||
|
@ -36,6 +43,9 @@ function testTruncateFoldersWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -52,6 +62,9 @@ function testTruncateFolderWithHomeDirWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
||||
local CURRENT_DIR=$(pwd)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
local FOLDER="powerlevel9k-test-${RANDOM}"
|
||||
mkdir -p $FOLDER
|
||||
|
@ -71,6 +84,9 @@ function testTruncateMiddleWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -87,6 +103,9 @@ function testTruncationFromRightWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -103,6 +122,9 @@ function testTruncateToLastWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_last"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -119,6 +141,9 @@ function testTruncateToFirstAndLastWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -135,6 +160,9 @@ function testTruncateAbsoluteWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -152,6 +180,9 @@ function testTruncationFromRightWithEmptyDelimiter() {
|
|||
local POWERLEVEL9K_SHORTEN_DELIMITER=""
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -167,6 +198,9 @@ function testTruncateWithFolderMarkerWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local BASEFOLDER=/tmp/powerlevel9k-test
|
||||
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
||||
mkdir -p $FOLDER
|
||||
|
@ -185,6 +219,9 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
|||
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
||||
local POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local BASEFOLDER=/tmp/powerlevel9k-test
|
||||
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
||||
mkdir -p $FOLDER
|
||||
|
@ -220,6 +257,9 @@ function testTruncateWithPackageNameWorks() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
|
@ -257,6 +297,9 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/as…/qwerqwer %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
|
@ -290,6 +333,9 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
|
|||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/.g…/re…/heads %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
|
@ -302,6 +348,9 @@ function testHomeFolderDetectionWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_HOME_ICON='home-icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
|
@ -313,6 +362,9 @@ function testHomeSubfolderDetectionWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_HOME_SUB_ICON='sub-icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=~/powerlevel9k-test
|
||||
mkdir $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -327,6 +379,9 @@ function testOtherFolderDetectionWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER=/tmp/powerlevel9k-test
|
||||
mkdir $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -340,6 +395,10 @@ function testChangingDirPathSeparator() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
local FOLDER="/tmp/powerlevel9k-test/1/2"
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
@ -353,25 +412,40 @@ function testChangingDirPathSeparator() {
|
|||
function testHomeFolderAbbreviation() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION
|
||||
local dir=$PWD
|
||||
|
||||
cd ~/
|
||||
# default
|
||||
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
# substituted
|
||||
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}qQq %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
cd /tmp
|
||||
# default
|
||||
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
# substituted
|
||||
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
cd "$dir"
|
||||
|
@ -382,6 +456,10 @@ function testOmittingFirstCharacterWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
||||
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -395,6 +473,10 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|||
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
||||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
|
@ -418,6 +500,10 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc
|
|||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
|
@ -434,6 +520,10 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca
|
|||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
|
@ -450,6 +540,10 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat
|
|||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
|
@ -466,6 +560,10 @@ function testTruncateToUniqueWorks() {
|
|||
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
||||
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test/adam/devl
|
||||
mkdir -p /tmp/powerlevel9k-test/alice/devl
|
||||
mkdir -p /tmp/powerlevel9k-test/alice/docs
|
||||
|
@ -482,6 +580,10 @@ function testBoldHomeDirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
|
||||
assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -493,6 +595,10 @@ function testBoldHomeSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
|
@ -506,6 +612,10 @@ function testBoldRootDirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd /
|
||||
|
||||
assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -517,6 +627,10 @@ function testBoldRootSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -528,6 +642,10 @@ function testBoldRootSubSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
|
@ -541,6 +659,10 @@ function testHighlightHomeWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
|
||||
assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -552,6 +674,10 @@ function testHighlightHomeSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
|
@ -565,6 +691,10 @@ function testHighlightRootWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd /
|
||||
|
||||
assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -576,6 +706,10 @@ function testHighlightRootSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
@ -587,6 +721,10 @@ function testHighlightRootSubSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
|
@ -600,6 +738,10 @@ function testDirSeparatorColorHomeSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
|
@ -613,6 +755,10 @@ function testDirSeparatorColorRootSubSubdirWorks() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
mkdir -p /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Test specific
|
||||
P9K_HOME=$(pwd)
|
||||
|
@ -39,6 +37,9 @@ function testDiskUsageSegmentWhenDiskIsAlmostFull() {
|
|||
/dev/disk1 487219288 471466944 15496344 97% /"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{red} %F{white%}hdd %f%F{white}97%% %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
|
@ -52,6 +53,9 @@ function testDiskUsageSegmentWhenDiskIsVeryFull() {
|
|||
/dev/disk1 487219288 471466944 15496344 94% /"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}94%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
|
@ -65,6 +69,9 @@ function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
|
|||
/dev/disk1 487219288 471466944 15496344 4% /"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}hdd %f%F{yellow}4%% %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
|
@ -89,11 +96,14 @@ function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShoul
|
|||
function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10
|
||||
df() {
|
||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
/dev/disk1 487219288 471466944 15496344 11% /"
|
||||
}
|
||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}11%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
|
||||
|
@ -103,12 +113,15 @@ function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
|||
function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage)
|
||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5
|
||||
local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10
|
||||
df() {
|
||||
echo "Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
/dev/disk1 487219288 471466944 15496344 11% /"
|
||||
}
|
||||
local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5
|
||||
local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{red} %F{white%}hdd %f%F{white}11%% %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function mockGo() {
|
||||
|
@ -39,6 +37,9 @@ function testGo() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(go_version)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
local PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
|
||||
|
||||
assertEquals "%K{green} %F{grey93%} %f%F{255}go1.5.3 %k%F{green}%f " "$(build_left_prompt)"
|
||||
|
@ -52,6 +53,9 @@ function testGoSegmentPrintsNothingIfEmptyGopath() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias go=mockGoEmptyGopath
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -61,6 +65,9 @@ function testGoSegmentPrintsNothingIfNotInGopath() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias go=mockGo
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -70,6 +77,9 @@ function testGoSegmentPrintsNothingIfGoIsNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias go=noGo
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias go
|
||||
|
|
|
@ -7,17 +7,18 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testIpSegmentPrintsNothingOnOsxIfNotConnected() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
||||
alias networksetup='echo "not connected"'
|
||||
local OS="OSX" # Fake OSX
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias networksetup
|
||||
|
@ -27,9 +28,12 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world)
|
||||
alias ip='echo "not connected"'
|
||||
local OS="Linux" # Fake Linux
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ip
|
||||
|
@ -38,7 +42,6 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
|||
function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='OSX' # Fake OSX
|
||||
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
||||
(1) Ethernet
|
||||
(Hardware Port: Ethernet, Device: en0)
|
||||
|
@ -61,6 +64,10 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
|||
|
||||
alias ipconfig="_(){ echo '1.2.3.4'; };_"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ipconfig
|
||||
|
@ -74,7 +81,6 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
|||
function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='OSX' # Fake OSX
|
||||
alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled.
|
||||
(1) Ethernet
|
||||
(Hardware Port: Ethernet, Device: en0)
|
||||
|
@ -113,6 +119,10 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
|||
}
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ipconfig
|
||||
|
@ -122,10 +132,13 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
|||
function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='OSX' # Fake OSX
|
||||
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
||||
alias ipconfig="_(){ echo '1.2.3.4'; };_"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ipconfig
|
||||
|
@ -134,7 +147,6 @@ function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
|||
function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
|
||||
setopt aliases
|
||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='Linux' # Fake Linux
|
||||
# That command is harder to test, as it is used at first
|
||||
# to get all relevant network interfaces and then for
|
||||
# getting the configuration of that segment..
|
||||
|
@ -151,18 +163,21 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
|
|||
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
|
||||
valid_lft forever preferred_lft forever';
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
unfunction ip
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ip
|
||||
}
|
||||
|
||||
function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
||||
setopt aliases
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='Linux' # Fake Linux
|
||||
# That command is harder to test, as it is used at first
|
||||
# to get all relevant network interfaces and then for
|
||||
# getting the configuration of that segment..
|
||||
|
@ -183,23 +198,30 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
|||
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
|
||||
valid_lft forever preferred_lft forever';
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
unfunction ip
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ip
|
||||
}
|
||||
|
||||
function testIpSegmentWorksOnLinuxWithInterfaceSpecified() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip)
|
||||
local OS='Linux' # Fake Linux
|
||||
local POWERLEVEL9K_IP_INTERFACE='xxx'
|
||||
ip(){
|
||||
echo '2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
|
||||
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
|
||||
valid_lft forever preferred_lft forever';
|
||||
}
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function mockKubectl() {
|
||||
|
@ -70,6 +68,9 @@ function testKubeContext() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||
alias kubectl=mockKubectl
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
|
@ -79,6 +80,9 @@ function testKubeContextOtherNamespace() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||
alias kubectl=mockKubectlOtherNamespace
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
|
@ -89,6 +93,9 @@ function testKubeContextPrintsNothingIfKubectlNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias kubectl=noKubectl
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function mockLaravelVersion() {
|
||||
|
@ -32,6 +30,9 @@ function testLaravelVersionSegment() {
|
|||
local POWERLEVEL9K_LARAVEL_ICON='x'
|
||||
alias php=mockLaravelVersion
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{001} %F{white%}x %f%F{white}5.4.23 %k%F{maroon}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
@ -44,6 +45,9 @@ function testLaravelVersionSegmentIfArtisanIsNotAvailable() {
|
|||
local POWERLEVEL9K_LARAVEL_ICON='x'
|
||||
alias php=mockNoLaravelVersion
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
@ -56,6 +60,9 @@ function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
local POWERLEVEL9K_LARAVEL_ICON='x'
|
||||
alias php=noPhp
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -38,9 +36,12 @@ function testLoadSegmentWorksOnOsx() {
|
|||
fi
|
||||
}
|
||||
|
||||
local OS="OSX" # Fake OSX
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unfunction sysctl
|
||||
|
@ -57,8 +58,11 @@ function testLoadSegmentWorksOnBsd() {
|
|||
fi
|
||||
}
|
||||
|
||||
local OS="BSD" # Fake BSD
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="BSD" # Fake BSD
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
|
@ -71,10 +75,12 @@ function testLoadSegmentWorksOnLinux() {
|
|||
echo "1.38 0.01 0.05 1/87 8641" > proc/loadavg
|
||||
|
||||
alias nproc="echo 4"
|
||||
|
||||
local OS="Linux" # Fake Linux
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
|
@ -89,10 +95,12 @@ function testLoadSegmentNormalState() {
|
|||
echo "1.00 0.01 0.05 1/87 8641" > proc/loadavg
|
||||
|
||||
alias nproc="echo 4"
|
||||
|
||||
local OS="Linux" # Fake Linux
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.00 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
|
@ -107,10 +115,12 @@ function testLoadSegmentWarningState() {
|
|||
echo "2.01 0.01 0.05 1/87 8641" > proc/loadavg
|
||||
|
||||
alias nproc="echo 4"
|
||||
|
||||
local OS="Linux" # Fake Linux
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}L %f%F{black}2.01 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
|
@ -125,10 +135,12 @@ function testLoadSegmentCriticalState() {
|
|||
echo "2.81 0.01 0.05 1/87 8641" > proc/loadavg
|
||||
|
||||
alias nproc="echo 4"
|
||||
|
||||
local OS="Linux" # Fake Linux
|
||||
local POWERLEVEL9K_LOAD_WHICH=1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{red} %F{black%}L %f%F{black}2.81 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
||||
|
@ -17,9 +15,11 @@ function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias node="nonode 2>/dev/null"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_CUSTOM_WORLD
|
||||
unalias node
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,9 @@ function testNodeVersionSegmentWorks() {
|
|||
echo "v1.2.3"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{white%}⬢ %f%F{white}1.2.3 %k%F{green}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Test specfic
|
||||
# unset all possible user specified variables
|
||||
|
@ -22,6 +20,9 @@ function testNodeenvSegmentPrintsNothingWithoutNode() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias node="nonode 2>/dev/null"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias node
|
||||
|
@ -35,6 +36,9 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {
|
|||
echo "v1.2.3"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
|
@ -50,6 +54,9 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() {
|
|||
NODE_VIRTUAL_ENV="node-env"
|
||||
NODE_VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unset NODE_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
|
@ -63,6 +70,9 @@ function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
|
|||
alias node="nonode 2>/dev/null"
|
||||
NODE_VIRTUAL_ENV="node-env"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}⬢ %f%F{green}[node-env] %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unset NODE_VIRTUAL_ENV
|
||||
|
@ -77,6 +87,9 @@ function testNodeenvSegmentWorks() {
|
|||
}
|
||||
NODE_VIRTUAL_ENV="node-env"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}⬢ %f%F{green}v1.2.3[node-env] %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -36,6 +34,9 @@ function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,9 @@ function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
|||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
function nvm_version() {
|
||||
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'
|
||||
}
|
||||
|
@ -55,6 +59,9 @@ function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
function nvm_version() {
|
||||
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v4.6.0'
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
||||
|
@ -17,6 +15,9 @@ function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias php="nophp"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
@ -30,6 +31,9 @@ Copyright (c) 1997-2016 The PHP Group
|
|||
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
|
||||
'"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{013} %F{255}PHP 5.6.27 %k%F{fuchsia}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
# Test specific
|
||||
P9K_HOME=$(pwd)
|
||||
|
@ -44,6 +42,9 @@ function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {
|
|||
# uses an alternative host.
|
||||
alias dig='nodig'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
|
@ -58,6 +59,9 @@ function testPublicIpSegmentPrintsNoticeIfNotConnected() {
|
|||
# uses an alternative host.
|
||||
alias dig='nodig'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}disconnected %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
|
@ -72,6 +76,9 @@ function testPublicIpSegmentWorksWithWget() {
|
|||
echo "wget 1.2.3.4"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}wget 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction wget
|
||||
|
@ -88,6 +95,9 @@ function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {
|
|||
echo "curl 1.2.3.4"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}curl 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction curl
|
||||
|
@ -104,6 +114,9 @@ function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable(
|
|||
echo "dig 1.2.3.4"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}dig 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
|
@ -118,6 +131,9 @@ function testPublicIpSegmentCachesFile() {
|
|||
echo "first"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
dig() {
|
||||
|
@ -138,6 +154,9 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
|||
echo "first"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
sleep 3
|
||||
|
@ -158,6 +177,9 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
|||
echo "first"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
# Truncate cache file
|
||||
|
@ -180,6 +202,9 @@ function testPublicIpSegmentWhenGoingOnline() {
|
|||
local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected"
|
||||
alias dig="nodig"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}disconnected %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -28,31 +26,40 @@ function tearDown() {
|
|||
}
|
||||
|
||||
function testRamSegmentWorksOnOsx() {
|
||||
local OS="OSX" # Fake OSX
|
||||
alias vm_stat="echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes)
|
||||
Pages free: 299687.
|
||||
Pages active: 1623792.
|
||||
Pages inactive: 1313411.
|
||||
'"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}6.15G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
|
||||
unalias vm_stat
|
||||
}
|
||||
|
||||
function testRamSegmentWorksOnBsd() {
|
||||
local OS="BSD" # Fake BSD
|
||||
mkdir -p var/run
|
||||
echo "avail memory 5678B 299687 4444G 299" > var/run/dmesg.boot
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="BSD" # Fake BSD
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}0.29M " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testRamSegmentWorksOnLinux() {
|
||||
local OS="Linux" # Fake Linux
|
||||
mkdir proc
|
||||
echo "MemAvailable: 299687" > proc/meminfo
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}0.29G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@ function setUp() {
|
|||
PATH="${RUST_TEST_FOLDER}:${PATH}"
|
||||
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
@ -33,6 +31,9 @@ function testRust() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
|
||||
mockRust
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{208} %F{black%}Rust %f%F{black}0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -41,6 +42,9 @@ function testRustPrintsNothingIfRustIsNotAvailable() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function mockRust() {
|
||||
echo 'rustc 0.4.1a-alpha'
|
||||
}
|
||||
|
||||
function testSshSegmentPrintsNothingIfNoSshConnection() {
|
||||
|
@ -25,6 +19,9 @@ function testSshSegmentPrintsNothingIfNoSshConnection() {
|
|||
unset SSH_CLIENT
|
||||
unset SSH_TTY
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -37,6 +34,9 @@ function testSshSegmentWorksIfOnlySshClientIsSet() {
|
|||
SSH_CLIENT='ssh-client'
|
||||
unset SSH_TTY
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_CLIENT
|
||||
|
@ -51,6 +51,9 @@ function testSshSegmentWorksIfOnlySshTtyIsSet() {
|
|||
SSH_TTY='ssh-tty'
|
||||
unset SSH_CLIENT
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_TTY
|
||||
|
@ -65,6 +68,9 @@ function testSshSegmentWorksIfAllNecessaryVariablesAreSet() {
|
|||
SSH_CLIENT='ssh-client'
|
||||
SSH_TTY='ssh-tty'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_TTY
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
### Test specific
|
||||
# Resets if someone has set these in his/hers env
|
||||
|
@ -23,6 +21,9 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
|
|||
local POWERLEVEL9K_STATUS_VERBOSE=false
|
||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -33,6 +34,9 @@ function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
|||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}✔%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -41,6 +45,9 @@ function testStatusInGeneralErrorCase() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=1
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -51,6 +58,9 @@ function testPipestatusInErrorCase() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local -a RETVALS
|
||||
RETVALS=(0 0 1 0)
|
||||
|
||||
|
@ -63,6 +73,9 @@ function testStatusCrossWinsOverVerbose() {
|
|||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||
local POWERLEVEL9K_STATUS_CROSS=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=1
|
||||
|
||||
assertEquals "%K{black} %F{red%}✘%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
|
@ -74,6 +87,9 @@ function testStatusShowsSignalNameInErrorCase() {
|
|||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=132
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)"
|
||||
|
@ -84,6 +100,10 @@ function testStatusSegmentIntegrated() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||
local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
||||
local POWERLEVEL9K_STATUS_CROSS=true
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
false; powerlevel9k_prepare_prompts
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -30,11 +28,14 @@ function tearDown() {
|
|||
function testSwapSegmentWorksOnOsx() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
||||
local OS="OSX" # Fake OSX
|
||||
sysctl() {
|
||||
echo "vm.swapusage: total = 3072,00M used = 1620,50M free = 1451,50M (encrypted)"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}SWP %f%F{black}1.58G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
|
||||
unfunction sysctl
|
||||
|
@ -43,11 +44,14 @@ function testSwapSegmentWorksOnOsx() {
|
|||
function testSwapSegmentWorksOnLinux() {
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap)
|
||||
local OS="Linux" # Fake Linux
|
||||
mkdir proc
|
||||
echo "SwapTotal: 1000000" > proc/meminfo
|
||||
echo "SwapFree: 1000" >> proc/meminfo
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}SWP %f%F{black}0.95G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -33,6 +31,8 @@ function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias swift="noswift"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
|
@ -46,6 +46,9 @@ function testSwiftSegmentWorks() {
|
|||
echo "Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\nTarget: x86_64-apple-macosx10.9"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}Swift %f%F{white}3.0.1 %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction swift
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -33,6 +31,9 @@ function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias php="nophp"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
|
@ -46,6 +47,9 @@ function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {
|
|||
# navigate into a folder that does not contain symfony.
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -61,6 +65,9 @@ function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
|||
Parse error: parse error, expecting `;´ or `{´ in /Users/dr/Privat/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 97"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
|
@ -77,6 +84,9 @@ function testSymfonyVersionSegmentWorks() {
|
|||
echo "Symfony version 3.1.4 - app/dev/debug"
|
||||
}
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{240} %F{black%}SF %f%F{black}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
|
@ -96,6 +106,9 @@ function testSymfonyVersionSegmentWorksInNestedFolder() {
|
|||
mkdir -p src/P9K/AppBundle
|
||||
cd src/P9K/AppBundle
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{240} %F{black%}SF %f%F{black}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -37,6 +35,9 @@ function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -48,6 +49,9 @@ function testTodoSegmentWorksAsExpected() {
|
|||
echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh
|
||||
chmod +x ${FOLDER}/bin/todo.sh
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{244} %F{black%}☑ %f%F{black}100 %k%F{grey50}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -75,6 +73,9 @@ function testColorOverridingForCleanStateWorks() {
|
|||
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
||||
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -88,6 +89,9 @@ function testColorOverridingForModifiedStateWorks() {
|
|||
git add testfile
|
||||
git commit -m "test" 1>/dev/null
|
||||
echo "test" > testfile
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{red} master ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
@ -100,6 +104,9 @@ function testColorOverridingForUntrackedStateWorks() {
|
|||
|
||||
touch testfile
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -107,6 +114,9 @@ function testGitIconWorks() {
|
|||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||
local POWERLEVEL9K_VCS_GIT_ICON='Git-Icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}Git-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -119,6 +129,9 @@ function testGitlabIconWorks() {
|
|||
# sufficient to show the GitLab-specific icon.
|
||||
git remote add origin https://gitlab.com/dritter/gitlab-test-project.git
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}GL-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -131,6 +144,9 @@ function testBitbucketIconWorks() {
|
|||
# sufficient to show the BitBucket-specific icon.
|
||||
git remote add origin https://dritter@bitbucket.org/dritter/dr-test.git
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}BB-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -143,6 +159,9 @@ function testGitHubIconWorks() {
|
|||
# sufficient to show the GitHub-specific icon.
|
||||
git remote add origin https://github.com/dritter/test.git
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}GH-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -154,6 +173,9 @@ function testUntrackedFilesIconWorks() {
|
|||
# Create untracked file
|
||||
touch "i-am-untracked.txt"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -169,7 +191,10 @@ function testStagedFilesIconWorks() {
|
|||
echo "xx" >> i-am-added.txt
|
||||
git add i-am-added.txt &>/dev/null
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master ✚ %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master + %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testUnstagedFilesIconWorks() {
|
||||
|
@ -183,7 +208,10 @@ function testUnstagedFilesIconWorks() {
|
|||
git commit -m "Add File" 1>/dev/null
|
||||
echo "xx" > i-am-modified.txt
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master M %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStashIconWorks() {
|
||||
|
@ -198,6 +226,9 @@ function testStashIconWorks() {
|
|||
echo "xx" > i-am-modified.txt
|
||||
git stash 1>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master S1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -211,6 +242,9 @@ function testTagIconWorks() {
|
|||
git commit -m "Add File" 1>/dev/null
|
||||
git tag "v0.0.1"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -229,6 +263,9 @@ function testTagIconInDetachedHeadState() {
|
|||
git checkout v0.0.1 &>/dev/null
|
||||
local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} ${hash} Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -249,6 +286,9 @@ function testActionHintWorks() {
|
|||
git commit -a -m "Provoke conflict" &>/dev/null
|
||||
git pull &>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master %F{red}| merge%f %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -268,6 +308,9 @@ function testIncomingHintWorks() {
|
|||
cd ../vcs-test2
|
||||
git fetch &>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master I1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -287,6 +330,9 @@ function testOutgoingHintWorks() {
|
|||
echo "xx" >> i-am-modified.txt
|
||||
git commit -a -m "Modified file" &>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master o1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -301,6 +347,9 @@ function testShorteningCommitHashWorks() {
|
|||
git commit -m "Add File" 1>/dev/null
|
||||
local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=3 HEAD)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
@ -317,6 +366,9 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
|||
git add file.txt
|
||||
git commit -m "Add File" 1>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
|
|
@ -7,8 +7,6 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
P9K_HOME=$(pwd)
|
||||
### Test specific
|
||||
|
@ -39,6 +37,9 @@ function testColorOverridingForCleanStateWorks() {
|
|||
local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan'
|
||||
local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{cyan} default %k%F{white}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -53,6 +54,9 @@ function testColorOverridingForModifiedStateWorks() {
|
|||
hg commit -m "test" 1>/dev/null
|
||||
echo "test" > testfile
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{red} default ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -67,6 +71,9 @@ function testAddedFilesIconWorks() {
|
|||
touch "myfile.txt"
|
||||
hg add myfile.txt
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} default ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -82,6 +89,9 @@ function testTagIconWorks() {
|
|||
hg commit -m "Add File" 1>/dev/null
|
||||
hg tag "v0.0.1"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} default Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -101,6 +111,9 @@ function testTagIconInDetachedHeadState() {
|
|||
hg checkout v0.0.1 &>/dev/null
|
||||
local hash=$(hg id)
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} ${hash} Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -121,6 +134,9 @@ function testActionHintWorks() {
|
|||
hg pull 1>/dev/null
|
||||
hg merge --tool internal:merge >/dev/null 2>&1
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} default %F{red}| merging%f %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -135,6 +151,9 @@ function testShorteningCommitHashWorks() {
|
|||
hg commit -m "Add File" 1>/dev/null
|
||||
local hash=$(hg id | head -c ${POWERLEVEL9K_CHANGESET_HASH_LENGTH})
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
@ -152,6 +171,9 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
|||
hg add file.txt
|
||||
hg commit -m "Add File" 1>/dev/null
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
@ -164,6 +186,9 @@ function testMercurialIconWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||
local POWERLEVEL9K_VCS_HG_ICON='HG-Icon'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}HG-Icon %f%F{black} default %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
@ -173,6 +198,9 @@ function testBookmarkIconWorks() {
|
|||
local POWERLEVEL9K_VCS_BOOKMARK_ICON='B'
|
||||
hg bookmark "initial"
|
||||
|
||||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} default Binitial %k%F{green}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,31 +7,41 @@ SHUNIT_PARENT=$0
|
|||
|
||||
function setUp() {
|
||||
export TERM="xterm-256color"
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
}
|
||||
|
||||
function testViInsertModeWorks() {
|
||||
local KEYMAP='viins'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViInsertModeWorksWhenLabeledAsMain() {
|
||||
local KEYMAP='main'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViCommandModeWorks() {
|
||||
local KEYMAP='vicmd'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}NORMAL " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViInsertModeStringIsCustomizable() {
|
||||
local KEYMAP='viins'
|
||||
|
||||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue