Prepare tests for performance optimizations

This commit is contained in:
Dominik Ritter 2018-07-25 07:52:06 +02:00
commit 06de83cc0f
31 changed files with 645 additions and 117 deletions

View file

@ -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'"