From 0d4004ef1926f0e0e79ec37390ce2840b7db6359 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 18 Jul 2018 22:27:44 +0200 Subject: Add tests for todo segment --- test/segments/todo.spec | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 test/segments/todo.spec (limited to 'test/segments/todo.spec') diff --git a/test/segments/todo.spec b/test/segments/todo.spec new file mode 100755 index 00000000..0d2d8203 --- /dev/null +++ b/test/segments/todo.spec @@ -0,0 +1,52 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme + + P9K_HOME=$(pwd) + ### Test specific + # Create default folder and git init it. + FOLDER=/tmp/powerlevel9k-test + mkdir -p "${FOLDER}" + mkdir ${FOLDER}/bin + OLD_PATH=$PATH + PATH=${FOLDER}/bin:$PATH + cd $FOLDER +} + +function tearDown() { + # Reset PATH + PATH=$OLD_PATH + # Go back to powerlevel9k folder + cd "${P9K_HOME}" + # Remove eventually created test-specific folder + rm -fr "${FOLDER}" + # At least remove test folder completely + rm -fr /tmp/powerlevel9k-test +} + +function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() { + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + + assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" +} + +function testTodoSegmentWorksAsExpected() { + # TODO: Skript in den PATH legen! + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo) + echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh + echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh + chmod +x ${FOLDER}/bin/todo.sh + + assertEquals "%K{244} %F{black%}☑ %f%F{black}100 %k%F{grey50}%f " "$(build_left_prompt)" +} + +source shunit2/source/2.1/src/shunit2 \ No newline at end of file -- cgit v1.2.3 From 16e5e14af747bb310dabd367648b5566cd2edc6b Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 19 Jul 2018 22:39:19 +0200 Subject: Fix tests on older ZSH versions --- test/segments/anaconda.spec | 12 ++++++--- test/segments/aws_eb_env.spec | 5 ++-- test/segments/background_jobs.spec | 12 ++++++--- test/segments/battery.spec | 12 --------- test/segments/context.spec | 21 ++++++++++------ test/segments/custom.spec | 18 +++++++++----- test/segments/detect_virt.spec | 14 +++++++---- test/segments/disk_usage.spec | 18 +++++++++----- test/segments/ip.spec | 21 ++++++++++------ test/segments/node_version.spec | 6 +++-- test/segments/nodeenv.spec | 15 +++++++---- test/segments/nvm.spec | 9 ++++--- test/segments/php_version.spec | 6 +++-- test/segments/public_ip.spec | 27 +++++++++++++------- test/segments/ram.spec | 3 --- test/segments/ssh.spec | 12 ++++++--- test/segments/status.spec | 34 +++++++++++++++---------- test/segments/swap.spec | 6 +++-- test/segments/swift_version.spec | 6 +++-- test/segments/symfony_version.spec | 15 +++++++---- test/segments/todo.spec | 6 +++-- test/segments/vcs-git.spec | 51 +++++++++++++++++++++++++------------- test/segments/vcs-hg.spec | 30 ++++++++++++++-------- 23 files changed, 227 insertions(+), 132 deletions(-) (limited to 'test/segments/todo.spec') diff --git a/test/segments/anaconda.spec b/test/segments/anaconda.spec index 11add849..da87c096 100755 --- a/test/segments/anaconda.spec +++ b/test/segments/anaconda.spec @@ -13,7 +13,8 @@ function setUp() { function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() { local POWERLEVEL9K_CUSTOM_WORLD='echo world' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda custom_world) # Unset anacona variables unset CONDA_ENV_PATH unset CONDA_PREFIX @@ -24,7 +25,8 @@ function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() { function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() { CONDA_ENV_PATH=/tmp unset CONDA_PREFIX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) local POWERLEVEL9K_PYTHON_ICON="icon-here" assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmp) %k%F{blue}%f " "$(build_left_prompt)" @@ -33,7 +35,8 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() { function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() { unset CONDA_ENV_PATH local CONDA_PREFIX="test" - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) local POWERLEVEL9K_PYTHON_ICON="icon-here" assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(test) %k%F{blue}%f " "$(build_left_prompt)" @@ -42,7 +45,8 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() { function testAnacondaSegmentWorks() { local CONDA_ENV_PATH=/tmp local CONDA_PREFIX="test" - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(anaconda) local POWERLEVEL9K_PYTHON_ICON="icon-here" assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)" diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec index 530da6a1..56042027 100755 --- a/test/segments/aws_eb_env.spec +++ b/test/segments/aws_eb_env.spec @@ -23,7 +23,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() { echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml cd /tmp/powerlevel9k-test - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" @@ -40,7 +40,8 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml cd /tmp/powerlevel9k-test/1/12/123/1234/12345 - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" diff --git a/test/segments/background_jobs.spec b/test/segments/background_jobs.spec index 9f866ff0..5a000b66 100755 --- a/test/segments/background_jobs.spec +++ b/test/segments/background_jobs.spec @@ -13,7 +13,8 @@ function setUp() { function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() { local POWERLEVEL9K_CUSTOM_WORLD='echo world' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs custom_world) alias jobs="nojobs 2>/dev/null" assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" @@ -23,7 +24,8 @@ function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() { function testBackgroundJobsSegmentWorksWithOneBackgroundJob() { unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) jobs() { echo '[1] + 30444 suspended nvim xx' } @@ -35,7 +37,8 @@ function testBackgroundJobsSegmentWorksWithOneBackgroundJob() { function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() { unset POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) jobs() { echo "[1] 31190 suspended nvim xx" echo "[2] - 31194 suspended nvim xx2" @@ -49,7 +52,8 @@ function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() { function testBackgroundJobsSegmentWithVerboseMode() { local POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(background_jobs) jobs() { echo "[1] 31190 suspended nvim xx" echo "[2] - 31194 suspended nvim xx2" diff --git a/test/segments/battery.spec b/test/segments/battery.spec index 808ecc6a..e49c3b34 100755 --- a/test/segments/battery.spec +++ b/test/segments/battery.spec @@ -65,7 +65,6 @@ function makeBatterySay() { function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() { local OS='OSX' # Fake OSX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true" @@ -74,7 +73,6 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() { function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() { local OS='OSX' # Fake OSX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true" @@ -83,7 +81,6 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() { function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() { local OS='OSX' # Fake OSX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true" @@ -92,7 +89,6 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() { function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() { local OS='OSX' # Fake OSX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true" @@ -109,7 +105,6 @@ function testBatterySegmentIfBatteryIsFullOnOSX() { function testBatterySegmentIfBatteryIsCalculatingOnOSX() { local OS='OSX' # Fake OSX - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "Now drawing from 'Battery Power' -InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true" @@ -118,7 +113,6 @@ function testBatterySegmentIfBatteryIsCalculatingOnOSX() { function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "4" "Discharging" assertEquals "%K{black} %F{red%}🔋 %f%F{red}4%% " "$(prompt_battery left 1 false ${FOLDER})" @@ -126,7 +120,6 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() { function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "4" "Charging" assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}4%% " "$(prompt_battery left 1 false ${FOLDER})" @@ -134,7 +127,6 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() { function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "10" "Discharging" assertEquals "%K{black} %F{white%}🔋 %f%F{white}10%% " "$(prompt_battery left 1 false ${FOLDER})" @@ -142,7 +134,6 @@ function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() { function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "10" "Charging" assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}10%% " "$(prompt_battery left 1 false ${FOLDER})" @@ -150,7 +141,6 @@ function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() { function testBatterySegmentIfBatteryIsFullOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "100" "Full" assertEquals "%K{black} %F{green%}🔋 %f%F{green}100%% " "$(prompt_battery left 1 false ${FOLDER})" @@ -158,7 +148,6 @@ function testBatterySegmentIfBatteryIsFullOnLinux() { function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "50" "Discharging" echo "echo 'Batter 0: Discharging, 50%, 01:38:54 remaining'" > ${FOLDER}/usr/bin/acpi chmod +x ${FOLDER}/usr/bin/acpi @@ -172,7 +161,6 @@ function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() { function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() { local OS='Linux' # Fake Linux - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(battery) makeBatterySay "50" "Discharging" # Todo: Include real acpi output! echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi diff --git a/test/segments/context.spec b/test/segments/context.spec index e86bc357..702280df 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -23,41 +23,47 @@ function tearDown() { function testContextSegmentDoesNotGetRenderedWithDefaultUser() { local DEFAULT_USER=$(whoami) local POWERLEVEL9K_CUSTOM_WORLD='echo world' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world) assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { local SSH_CLIENT="putty" - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)" } function testContextSegmentWithForeignUser() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)" } # TODO: How to test root? function testContextSegmentWithRootUser() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) startSkipping # Skip test assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)" } function testOverridingContextTemplate() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) local POWERLEVEL9K_CONTEXT_TEMPLATE=xx assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)" } function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true local DEFAULT_USER=$(whoami) @@ -65,7 +71,8 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { } function testContextSegmentIsShownIfForced() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) local POWERLEVEL9K_ALWAYS_SHOW_USER=true local DEFAULT_USER=$(whoami) diff --git a/test/segments/custom.spec b/test/segments/custom.spec index dea1577f..261e2508 100755 --- a/test/segments/custom.spec +++ b/test/segments/custom.spec @@ -12,14 +12,16 @@ function setUp() { } function testCustomDirectOutputSegment() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) local POWERLEVEL9K_CUSTOM_WORLD="echo world" - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } function testCustomClosureSegment() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) function p9k_hello_world() { echo "world" } @@ -29,7 +31,8 @@ function testCustomClosureSegment() { } function testSettingBackgroundForCustomSegment() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) local POWERLEVEL9K_CUSTOM_WORLD="echo world" local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND="yellow" @@ -37,7 +40,8 @@ function testSettingBackgroundForCustomSegment() { } function testSettingForegroundForCustomSegment() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) local POWERLEVEL9K_CUSTOM_WORLD="echo world" local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND="red" @@ -45,7 +49,8 @@ function testSettingForegroundForCustomSegment() { } function testSettingVisualIdentifierForCustomSegment() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) local POWERLEVEL9K_CUSTOM_WORLD="echo world" local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw" @@ -53,7 +58,8 @@ function testSettingVisualIdentifierForCustomSegment() { } function testSettingVisualIdentifierForegroundColorForCustomSegment() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) local POWERLEVEL9K_CUSTOM_WORLD="echo world" local POWERLEVEL9K_CUSTOM_WORLD_ICON="hw" local POWERLEVEL9K_CUSTOM_WORLD_VISUAL_IDENTIFIER_COLOR="red" diff --git a/test/segments/detect_virt.spec b/test/segments/detect_virt.spec index efda6f43..f6cc2ee5 100755 --- a/test/segments/detect_virt.spec +++ b/test/segments/detect_virt.spec @@ -12,10 +12,11 @@ function setUp() { } function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world) + local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias systemd-detect-virt="novirt" - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt custom_world) - local POWERLEVEL9K_CUSTOM_WORLD='echo world' assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" @@ -23,7 +24,8 @@ function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() { } function testDetectVirtSegmentIfSystemdReturnsPlainName() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) alias systemd-detect-virt="echo 'xxx'" assertEquals "%K{black} %F{yellow}xxx %k%F{black}%f " "$(build_left_prompt)" @@ -32,7 +34,8 @@ function testDetectVirtSegmentIfSystemdReturnsPlainName() { } function testDetectVirtSegmentIfRootFsIsOnExpectedInode() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) # Well. This is a weak test, as it fixates the implementation, # but it is necessary, as the implementation relys on the root # directory having the inode number "2".. @@ -49,7 +52,8 @@ function testDetectVirtSegmentIfRootFsIsOnExpectedInode() { } function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(detect_virt) # Well. This is a weak test, as it fixates the implementation, # but it is necessary, as the implementation relys on the root # directory having the inode number "2".. diff --git a/test/segments/disk_usage.spec b/test/segments/disk_usage.spec index 574445d9..f6172c9f 100755 --- a/test/segments/disk_usage.spec +++ b/test/segments/disk_usage.spec @@ -32,11 +32,12 @@ function tearDown() { } function testDiskUsageSegmentWhenDiskIsAlmostFull() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 97% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) assertEquals "%K{red} %F{white%}hdd %f%F{white}97%% %k%F{red}%f " "$(build_left_prompt)" @@ -44,11 +45,12 @@ function testDiskUsageSegmentWhenDiskIsAlmostFull() { } function testDiskUsageSegmentWhenDiskIsVeryFull() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 94% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) assertEquals "%K{yellow} %F{black%}hdd %f%F{black}94%% %k%F{yellow}%f " "$(build_left_prompt)" @@ -56,11 +58,12 @@ function testDiskUsageSegmentWhenDiskIsVeryFull() { } function testDiskUsageSegmentWhenDiskIsQuiteEmpty() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 4% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) assertEquals "%K{black} %F{yellow%}hdd %f%F{yellow}4%% %k%F{black}%f " "$(build_left_prompt)" @@ -68,12 +71,13 @@ function testDiskUsageSegmentWhenDiskIsQuiteEmpty() { } function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShouldBeDisplayed() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 4% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage custom_world) local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true local POWERLEVEL9K_CUSTOM_WORLD='echo world' @@ -83,11 +87,12 @@ function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShoul } function testDiskUsageSegmentWarningLevelCouldBeAdjusted() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 11% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=10 assertEquals "%K{yellow} %F{black%}hdd %f%F{black}11%% %k%F{yellow}%f " "$(build_left_prompt)" @@ -96,11 +101,12 @@ function testDiskUsageSegmentWarningLevelCouldBeAdjusted() { } function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) df() { echo "Filesystem 1K-blocks Used Available Use% Mounted on /dev/disk1 487219288 471466944 15496344 11% /" } - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(disk_usage) local POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=5 local POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=10 diff --git a/test/segments/ip.spec b/test/segments/ip.spec index 3ae2d389..0d07b6ee 100755 --- a/test/segments/ip.spec +++ b/test/segments/ip.spec @@ -12,8 +12,9 @@ function setUp() { } function testIpSegmentPrintsNothingOnOsxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) alias networksetup='echo "not connected"' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) local OS="OSX" # Fake OSX local POWERLEVEL9K_CUSTOM_WORLD='echo world' @@ -23,8 +24,9 @@ function testIpSegmentPrintsNothingOnOsxIfNotConnected() { } function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) alias ip='echo "not connected"' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) local OS="Linux" # Fake Linux local POWERLEVEL9K_CUSTOM_WORLD='echo world' @@ -34,7 +36,8 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { } function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + 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 @@ -69,7 +72,8 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() { # in hierarchical order, but from outside this is not obvious # (implementation detail). So we need a test for this case. function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + 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 @@ -116,7 +120,8 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() { } function testIpSegmentWorksOnOsxWithInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='OSX' # Fake OSX local POWERLEVEL9K_IP_INTERFACE='xxx' alias ipconfig="_(){ echo '1.2.3.4'; };_" @@ -155,7 +160,8 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() { function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() { setopt aliases - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + 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 @@ -185,7 +191,8 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() { } function testIpSegmentWorksOnLinuxWithInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='Linux' # Fake Linux local POWERLEVEL9K_IP_INTERFACE='xxx' ip(){ diff --git a/test/segments/node_version.spec b/test/segments/node_version.spec index 2fe3594e..b516e5ff 100755 --- a/test/segments/node_version.spec +++ b/test/segments/node_version.spec @@ -12,7 +12,8 @@ function setUp() { } function testNodeVersionSegmentPrintsNothingWithoutNode() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias node="nonode 2>/dev/null" @@ -23,7 +24,8 @@ function testNodeVersionSegmentPrintsNothingWithoutNode() { } function testNodeVersionSegmentWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(node_version) node() { echo "v1.2.3" } diff --git a/test/segments/nodeenv.spec b/test/segments/nodeenv.spec index bfa1d7fa..511a1a19 100755 --- a/test/segments/nodeenv.spec +++ b/test/segments/nodeenv.spec @@ -17,7 +17,8 @@ function setUp() { } function testNodeenvSegmentPrintsNothingWithoutNode() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias node="nonode 2>/dev/null" @@ -27,7 +28,8 @@ function testNodeenvSegmentPrintsNothingWithoutNode() { } function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' node() { echo "v1.2.3" @@ -39,7 +41,8 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() { } function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' node() { echo "v1.2.3" @@ -55,7 +58,8 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() { } function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) alias node="nonode 2>/dev/null" NODE_VIRTUAL_ENV="node-env" @@ -66,7 +70,8 @@ function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() { } function testNodeenvSegmentWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nodeenv) node() { echo "v1.2.3" } diff --git a/test/segments/nvm.spec b/test/segments/nvm.spec index 8f3b3c26..f4a4812a 100755 --- a/test/segments/nvm.spec +++ b/test/segments/nvm.spec @@ -32,14 +32,16 @@ function tearDown() { } function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } function testNvmSegmentWorksWithoutHavingADefaultAlias() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm) function nvm_version() { [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0' @@ -49,7 +51,8 @@ function testNvmSegmentWorksWithoutHavingADefaultAlias() { } function testNvmSegmentPrintsNothingWhenOnDefaultVersion() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(nvm custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' function nvm_version() { diff --git a/test/segments/php_version.spec b/test/segments/php_version.spec index ccf157c9..51fb398f 100755 --- a/test/segments/php_version.spec +++ b/test/segments/php_version.spec @@ -12,7 +12,8 @@ function setUp() { } function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias php="nophp" @@ -22,7 +23,8 @@ function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() { } function testPhpVersionSegmentWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version) alias php="echo 'PHP 5.6.27 (cli) (built: Oct 23 2016 11:47:58) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies diff --git a/test/segments/public_ip.spec b/test/segments/public_ip.spec index a9c0a770..80dff215 100755 --- a/test/segments/public_ip.spec +++ b/test/segments/public_ip.spec @@ -36,7 +36,8 @@ function tearDown() { } function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip custom_world) local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz' local POWERLEVEL9K_CUSTOM_WORLD='echo world' # We need to overwrite dig, as this is a fallback method that @@ -49,7 +50,8 @@ function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() { } function testPublicIpSegmentPrintsNoticeIfNotConnected() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) local POWERLEVEL9K_PUBLIC_IP_HOST='http://unknown.xyz' local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected" # We need to overwrite dig, as this is a fallback method that @@ -62,7 +64,8 @@ function testPublicIpSegmentPrintsNoticeIfNotConnected() { } function testPublicIpSegmentWorksWithWget() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) alias dig='nodig' alias curl='nocurl' wget() { @@ -77,7 +80,8 @@ function testPublicIpSegmentWorksWithWget() { } function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) alias dig='nodig' alias wget='nowget' curl() { @@ -92,7 +96,8 @@ function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() { } function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) alias curl='nocurl' alias wget='nowget' dig() { @@ -107,7 +112,8 @@ function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable( } function testPublicIpSegmentCachesFile() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) dig() { echo "first" } @@ -125,7 +131,8 @@ function testPublicIpSegmentCachesFile() { } function testPublicIpSegmentRefreshesCachesFileAfterTimeout() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) local POWERLEVEL9K_PUBLIC_IP_TIMEOUT=2 dig() { echo "first" @@ -145,7 +152,8 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() { } function testPublicIpSegmentRefreshesCachesFileIfEmpty() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) dig() { echo "first" } @@ -166,7 +174,8 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() { } function testPublicIpSegmentWhenGoingOnline() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(public_ip) local POWERLEVEL9K_PUBLIC_IP_METHODS="dig" local POWERLEVEL9K_PUBLIC_IP_NONE="disconnected" alias dig="nodig" diff --git a/test/segments/ram.spec b/test/segments/ram.spec index 104b8c82..0deaacf9 100755 --- a/test/segments/ram.spec +++ b/test/segments/ram.spec @@ -28,7 +28,6 @@ function tearDown() { } function testRamSegmentWorksOnOsx() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram) local OS="OSX" # Fake OSX alias vm_stat="echo 'Mach Virtual Memory Statistics: (page size of 4096 bytes) Pages free: 299687. @@ -42,7 +41,6 @@ Pages inactive: 1313411. } function testRamSegmentWorksOnBsd() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram) local OS="BSD" # Fake BSD mkdir -p var/run echo "avail memory 5678B 299687 4444G 299" > var/run/dmesg.boot @@ -51,7 +49,6 @@ function testRamSegmentWorksOnBsd() { } function testRamSegmentWorksOnLinux() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ram) local OS="Linux" # Fake Linux mkdir proc echo "MemAvailable: 299687" > proc/meminfo diff --git a/test/segments/ssh.spec b/test/segments/ssh.spec index 2ad4341e..a5360072 100755 --- a/test/segments/ssh.spec +++ b/test/segments/ssh.spec @@ -16,7 +16,8 @@ function mockRust() { } function testSshSegmentPrintsNothingIfNoSshConnection() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo "world"' local POWERLEVEL9K_SSH_ICON="ssh-icon" # Weak test: Emulate No SSH connection by unsetting @@ -28,7 +29,8 @@ function testSshSegmentPrintsNothingIfNoSshConnection() { } function testSshSegmentWorksIfOnlySshClientIsSet() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) local POWERLEVEL9K_SSH_ICON="ssh-icon" # Weak test: Emulate No SSH connection by unsetting # $SSH_CLIENT and $SSH_TTY @@ -41,7 +43,8 @@ function testSshSegmentWorksIfOnlySshClientIsSet() { } function testSshSegmentWorksIfOnlySshTtyIsSet() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) local POWERLEVEL9K_SSH_ICON="ssh-icon" # Weak test: Emulate No SSH connection by unsetting # $SSH_CLIENT and $SSH_TTY @@ -54,7 +57,8 @@ function testSshSegmentWorksIfOnlySshTtyIsSet() { } function testSshSegmentWorksIfAllNecessaryVariablesAreSet() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh) local POWERLEVEL9K_SSH_ICON="ssh-icon" # Weak test: Emulate No SSH connection by unsetting # $SSH_CLIENT and $SSH_TTY diff --git a/test/segments/status.spec b/test/segments/status.spec index 21bd65bb..d921111b 100755 --- a/test/segments/status.spec +++ b/test/segments/status.spec @@ -17,8 +17,9 @@ function setUp() { } function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status custom_world) local POWERLEVEL9K_STATUS_VERBOSE=false local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false @@ -26,56 +27,63 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() { } function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) local POWERLEVEL9K_STATUS_VERBOSE=true local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) assertEquals "%K{black} %F{green%}✔%f %k%F{black}%f " "$(build_left_prompt)" } function testStatusInGeneralErrorCase() { - local RETVAL=1 - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) local POWERLEVEL9K_STATUS_VERBOSE=true local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false + local RETVAL=1 assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)" } function testPipestatusInErrorCase() { - local -a RETVALS - RETVALS=(0 0 1 0) - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) local POWERLEVEL9K_STATUS_VERBOSE=true local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true + local -a RETVALS + RETVALS=(0 0 1 0) assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}0|0|1|0 %k%F{red}%f " "$(build_left_prompt)" } function testStatusCrossWinsOverVerbose() { - local RETVAL=1 - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false local POWERLEVEL9K_STATUS_VERBOSE=true local POWERLEVEL9K_STATUS_CROSS=true + local RETVAL=1 assertEquals "%K{black} %F{red%}✘%f %k%F{black}%f " "$(build_left_prompt)" } function testStatusShowsSignalNameInErrorCase() { - local RETVAL=132 - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false local POWERLEVEL9K_STATUS_VERBOSE=true local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false + local RETVAL=132 assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)" } function testStatusSegmentIntegrated() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) - local POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status) + local -a POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() false; powerlevel9k_prepare_prompts diff --git a/test/segments/swap.spec b/test/segments/swap.spec index 52719395..58f35c0a 100755 --- a/test/segments/swap.spec +++ b/test/segments/swap.spec @@ -28,7 +28,8 @@ function tearDown() { } function testSwapSegmentWorksOnOsx() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap) + 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)" @@ -40,7 +41,8 @@ function testSwapSegmentWorksOnOsx() { } function testSwapSegmentWorksOnLinux() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swap) local OS="Linux" # Fake Linux mkdir proc echo "SwapTotal: 1000000" > proc/meminfo diff --git a/test/segments/swift_version.spec b/test/segments/swift_version.spec index e58cc817..5634de11 100755 --- a/test/segments/swift_version.spec +++ b/test/segments/swift_version.spec @@ -28,7 +28,8 @@ function tearDown() { } function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias swift="noswift" @@ -39,7 +40,8 @@ function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() { } function testSwiftSegmentWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(swift_version) function swift() { echo "Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)\nTarget: x86_64-apple-macosx10.9" } diff --git a/test/segments/symfony_version.spec b/test/segments/symfony_version.spec index ba0bf96a..65d193b0 100755 --- a/test/segments/symfony_version.spec +++ b/test/segments/symfony_version.spec @@ -28,7 +28,8 @@ function tearDown() { } function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' alias php="nophp" @@ -38,7 +39,8 @@ function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() { } function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) # "Symfony" is not a command, but rather a framework. # To sucessfully execute this test, we just need to # navigate into a folder that does not contain symfony. @@ -48,7 +50,8 @@ function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() { } function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' mkdir app touch app/AppKernel.php @@ -65,7 +68,8 @@ function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() { function testSymfonyVersionSegmentWorks() { startSkipping # Skip test - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) mkdir app touch app/AppKernel.php @@ -80,7 +84,8 @@ function testSymfonyVersionSegmentWorks() { function testSymfonyVersionSegmentWorksInNestedFolder() { startSkipping # Skip test - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(symfony2_version) mkdir app touch app/AppKernel.php diff --git a/test/segments/todo.spec b/test/segments/todo.spec index 0d2d8203..1dae9a68 100755 --- a/test/segments/todo.spec +++ b/test/segments/todo.spec @@ -33,7 +33,8 @@ function tearDown() { } function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo custom_world) local POWERLEVEL9K_CUSTOM_WORLD='echo world' assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" @@ -41,7 +42,8 @@ function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() { function testTodoSegmentWorksAsExpected() { # TODO: Skript in den PATH legen! - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(todo) echo '#!/bin/sh' > ${FOLDER}/bin/todo.sh echo 'echo "TODO: 34 of 100 tasks shown";' >> ${FOLDER}/bin/todo.sh chmod +x ${FOLDER}/bin/todo.sh diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec index 9429589d..3ae4077e 100755 --- a/test/segments/vcs-git.spec +++ b/test/segments/vcs-git.spec @@ -70,7 +70,8 @@ function tearDown() { } function testColorOverridingForCleanStateWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' @@ -78,7 +79,8 @@ function testColorOverridingForCleanStateWorks() { } function testColorOverridingForModifiedStateWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' @@ -91,7 +93,8 @@ function testColorOverridingForModifiedStateWorks() { } function testColorOverridingForUntrackedStateWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan' local POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow' @@ -108,7 +111,8 @@ function testGitIconWorks() { } function testGitlabIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_GIT_GITLAB_ICON='GL-Icon' # Add a GitLab project as remote origin. This is @@ -119,7 +123,8 @@ function testGitlabIconWorks() { } function testBitbucketIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='BB-Icon' # Add a BitBucket project as remote origin. This is @@ -130,7 +135,8 @@ function testBitbucketIconWorks() { } function testGitHubIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_GIT_GITHUB_ICON='GH-Icon' # Add a GitHub project as remote origin. This is @@ -141,7 +147,8 @@ function testGitHubIconWorks() { } function testUntrackedFilesIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_UNTRACKED_ICON='?' # Create untracked file @@ -151,7 +158,8 @@ function testUntrackedFilesIconWorks() { } function testStagedFilesIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_STAGED_ICON='+' # Create staged file @@ -165,7 +173,8 @@ function testStagedFilesIconWorks() { } function testUnstagedFilesIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_UNSTAGED_ICON='M' # Create unstaged (modified, but not added to index) file @@ -178,7 +187,8 @@ function testUnstagedFilesIconWorks() { } function testStashIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_STASH_ICON='S' # Create modified file @@ -192,7 +202,8 @@ function testStashIconWorks() { } function testTagIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_TAG_ICON='T' touch "file.txt" @@ -204,7 +215,8 @@ function testTagIconWorks() { } function testTagIconInDetachedHeadState() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_TAG_ICON='T' touch "file.txt" @@ -221,7 +233,8 @@ function testTagIconInDetachedHeadState() { } function testActionHintWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) touch "i-am-modified.txt" git add i-am-modified.txt @@ -240,7 +253,8 @@ function testActionHintWorks() { } function testIncomingHintWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='I' touch "i-am-modified.txt" @@ -258,7 +272,8 @@ function testIncomingHintWorks() { } function testOutgoingHintWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='o' touch "i-am-modified.txt" @@ -276,7 +291,8 @@ function testOutgoingHintWorks() { } function testShorteningCommitHashWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_SHOW_CHANGESET=true local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' @@ -292,7 +308,8 @@ function testShorteningCommitHashWorks() { } function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_SHOW_CHANGESET=false local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' diff --git a/test/segments/vcs-hg.spec b/test/segments/vcs-hg.spec index 6d8c6428..91d25ae6 100755 --- a/test/segments/vcs-hg.spec +++ b/test/segments/vcs-hg.spec @@ -34,7 +34,8 @@ function tearDown() { } function testColorOverridingForCleanStateWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' @@ -42,7 +43,8 @@ function testColorOverridingForCleanStateWorks() { } function testColorOverridingForModifiedStateWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' local POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' @@ -60,7 +62,8 @@ function testColorOverridingForModifiedStateWorks() { # This may be improved in future versions, to be a bit more consistent with # the git part. function testAddedFilesIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) touch "myfile.txt" hg add myfile.txt @@ -70,7 +73,8 @@ function testAddedFilesIconWorks() { # We don't support tagging in mercurial right now.. function testTagIconWorks() { startSkipping # Skip test - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_TAG_ICON='T' touch "file.txt" @@ -83,7 +87,8 @@ function testTagIconWorks() { function testTagIconInDetachedHeadState() { startSkipping # Skip test - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_TAG_ICON='T' touch "file.txt" @@ -100,7 +105,8 @@ function testTagIconInDetachedHeadState() { } function testActionHintWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) touch "i-am-modified.txt" hg add i-am-modified.txt hg commit -m "Add File" &>/dev/null @@ -119,7 +125,8 @@ function testActionHintWorks() { } function testShorteningCommitHashWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_SHOW_CHANGESET=true local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' @@ -136,7 +143,8 @@ function testShorteningCommitHashWorks() { } function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_SHOW_CHANGESET=false local POWERLEVEL9K_CHANGESET_HASH_LENGTH='4' @@ -152,14 +160,16 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { } function testMercurialIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_HG_ICON='HG-Icon' assertEquals "%K{green} %F{black%}HG-Icon %f%F{black} default %k%F{green}%f " "$(build_left_prompt)" } function testBookmarkIconWorks() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_BOOKMARK_ICON='B' hg bookmark "initial" -- cgit v1.2.3 From 06de83cc0f2282b2217c6151277dfd6789593c2e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 25 Jul 2018 07:52:06 +0200 Subject: Prepare tests for performance optimizations --- test/segments/anaconda.spec | 31 ++++-- test/segments/aws_eb_env.spec | 25 +++-- test/segments/background_jobs.spec | 14 ++- test/segments/battery.spec | 1 + test/segments/command_execution_time.spec | 32 +++++- test/segments/context.spec | 25 ++++- test/segments/custom.spec | 20 +++- test/segments/detect_virt.spec | 12 +++ test/segments/dir.spec | 160 ++++++++++++++++++++++++++++-- test/segments/disk_usage.spec | 23 ++++- test/segments/go_version.spec | 14 ++- test/segments/ip.spec | 56 +++++++---- test/segments/kubecontext.spec | 11 +- test/segments/laravel_version.spec | 11 +- test/segments/load.spec | 28 ++++-- test/segments/node_version.spec | 9 +- test/segments/nodeenv.spec | 17 +++- test/segments/nvm.spec | 11 +- test/segments/php_version.spec | 8 +- test/segments/public_ip.spec | 29 +++++- test/segments/ram.spec | 17 +++- test/segments/rust_version.spec | 8 +- test/segments/ssh.spec | 18 ++-- test/segments/status.spec | 24 ++++- test/segments/swap.spec | 12 ++- test/segments/swift_version.spec | 7 +- test/segments/symfony_version.spec | 17 +++- test/segments/todo.spec | 8 +- test/segments/vcs-git.spec | 60 ++++++++++- test/segments/vcs-hg.spec | 32 +++++- test/segments/vi_mode.spec | 14 ++- 31 files changed, 641 insertions(+), 113 deletions(-) (limited to 'test/segments/todo.spec') diff --git a/test/segments/anaconda.spec b/test/segments/anaconda.spec index da87c096..2aa8d272 100755 --- a/test/segments/anaconda.spec +++ b/test/segments/anaconda.spec @@ -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 \ No newline at end of file diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec index 56042027..42740ea6 100755 --- a/test/segments/aws_eb_env.spec +++ b/test/segments/aws_eb_env.spec @@ -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 diff --git a/test/segments/background_jobs.spec b/test/segments/background_jobs.spec index 5a000b66..c38f2d17 100755 --- a/test/segments/background_jobs.spec +++ b/test/segments/background_jobs.spec @@ -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 diff --git a/test/segments/battery.spec b/test/segments/battery.spec index e49c3b34..835e1468 100755 --- a/test/segments/battery.spec +++ b/test/segments/battery.spec @@ -37,6 +37,7 @@ function tearDown() { unset PMSET_PATH unset BATTERY_PATH unset FOLDER + unset P9K_HOME } # Mock Battery diff --git a/test/segments/command_execution_time.spec b/test/segments/command_execution_time.spec index 7700aaa1..65623a00 100755 --- a/test/segments/command_execution_time.spec +++ b/test/segments/command_execution_time.spec @@ -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)" diff --git a/test/segments/context.spec b/test/segments/context.spec index 702280df..b350caf7 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -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)" } diff --git a/test/segments/custom.spec b/test/segments/custom.spec index 261e2508..b7719d1c 100755 --- a/test/segments/custom.spec +++ b/test/segments/custom.spec @@ -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)" } diff --git a/test/segments/detect_virt.spec b/test/segments/detect_virt.spec index 2dad6af0..7df92a24 100755 --- a/test/segments/detect_virt.spec +++ b/test/segments/detect_virt.spec @@ -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'" diff --git a/test/segments/dir.spec b/test/segments/dir.spec index df80b23c..1f0440cd 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -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 diff --git a/test/segments/disk_usage.spec b/test/segments/disk_usage.spec index f6172c9f..ece19bb5 100755 --- a/test/segments/disk_usage.spec +++ b/test/segments/disk_usage.spec @@ -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)" diff --git a/test/segments/go_version.spec b/test/segments/go_version.spec index 1be2e8c8..6d8f13b9 100755 --- a/test/segments/go_version.spec +++ b/test/segments/go_version.spec @@ -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 diff --git a/test/segments/ip.spec b/test/segments/ip.spec index 0d07b6ee..190953ad 100755 --- a/test/segments/ip.spec +++ b/test/segments/ip.spec @@ -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: 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)" diff --git a/test/segments/kubecontext.spec b/test/segments/kubecontext.spec index 46fe8724..746ab806 100755 --- a/test/segments/kubecontext.spec +++ b/test/segments/kubecontext.spec @@ -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 diff --git a/test/segments/laravel_version.spec b/test/segments/laravel_version.spec index 9d3de2d4..f4fd704d 100755 --- a/test/segments/laravel_version.spec +++ b/test/segments/laravel_version.spec @@ -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 diff --git a/test/segments/load.spec b/test/segments/load.spec index 45e28db3..f7c1b9be 100755 --- a/test/segments/load.spec +++ b/test/segments/load.spec @@ -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,9 +75,11 @@ function testLoadSegmentWorksOnLinux() { echo "1.38 0.01 0.05 1/87 8641" > proc/loadavg alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local OS="Linux" # Fake Linux - local POWERLEVEL9K_LOAD_WHICH=1 assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})" @@ -89,9 +95,11 @@ function testLoadSegmentNormalState() { echo "1.00 0.01 0.05 1/87 8641" > proc/loadavg alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local OS="Linux" # Fake Linux - local POWERLEVEL9K_LOAD_WHICH=1 assertEquals "%K{green} %F{black%}L %f%F{black}1.00 " "$(prompt_load left 1 false ${FOLDER})" @@ -107,9 +115,11 @@ function testLoadSegmentWarningState() { echo "2.01 0.01 0.05 1/87 8641" > proc/loadavg alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local OS="Linux" # Fake Linux - local POWERLEVEL9K_LOAD_WHICH=1 assertEquals "%K{yellow} %F{black%}L %f%F{black}2.01 " "$(prompt_load left 1 false ${FOLDER})" @@ -125,9 +135,11 @@ function testLoadSegmentCriticalState() { echo "2.81 0.01 0.05 1/87 8641" > proc/loadavg alias nproc="echo 4" + local POWERLEVEL9K_LOAD_WHICH=1 + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme local OS="Linux" # Fake Linux - local POWERLEVEL9K_LOAD_WHICH=1 assertEquals "%K{red} %F{black%}L %f%F{black}2.81 " "$(prompt_load left 1 false ${FOLDER})" diff --git a/test/segments/node_version.spec b/test/segments/node_version.spec index b516e5ff..d003f5c3 100755 --- a/test/segments/node_version.spec +++ b/test/segments/node_version.spec @@ -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 diff --git a/test/segments/nodeenv.spec b/test/segments/nodeenv.spec index 511a1a19..aff22586 100755 --- a/test/segments/nodeenv.spec +++ b/test/segments/nodeenv.spec @@ -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 diff --git a/test/segments/nvm.spec b/test/segments/nvm.spec index f4a4812a..c8e99ea3 100755 --- a/test/segments/nvm.spec +++ b/test/segments/nvm.spec @@ -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' } diff --git a/test/segments/php_version.spec b/test/segments/php_version.spec index 51fb398f..4b9ab753 100755 --- a/test/segments/php_version.spec +++ b/test/segments/php_version.spec @@ -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 diff --git a/test/segments/public_ip.spec b/test/segments/public_ip.spec index 80dff215..c4b2ae88 100755 --- a/test/segments/public_ip.spec +++ b/test/segments/public_ip.spec @@ -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 diff --git a/test/segments/ram.spec b/test/segments/ram.spec index 0deaacf9..dc0b6c6b 100755 --- a/test/segments/ram.spec +++ b/test/segments/ram.spec @@ -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})" } diff --git a/test/segments/rust_version.spec b/test/segments/rust_version.spec index 3d627498..583807a6 100755 --- a/test/segments/rust_version.spec +++ b/test/segments/rust_version.spec @@ -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)" } diff --git a/test/segments/ssh.spec b/test/segments/ssh.spec index a5360072..a6701dcf 100755 --- a/test/segments/ssh.spec +++ b/test/segments/ssh.spec @@ -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 diff --git a/test/segments/status.spec b/test/segments/status.spec index d921111b..b3ba3e36 100755 --- a/test/segments/status.spec +++ b/test/segments/status.spec @@ -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 diff --git a/test/segments/swap.spec b/test/segments/swap.spec index 58f35c0a..20a2d40a 100755 --- a/test/segments/swap.spec +++ b/test/segments/swap.spec @@ -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})" } diff --git a/test/segments/swift_version.spec b/test/segments/swift_version.spec index 5634de11..da9aaa92 100755 --- a/test/segments/swift_version.spec +++ b/test/segments/swift_version.spec @@ -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 diff --git a/test/segments/symfony_version.spec b/test/segments/symfony_version.spec index 65d193b0..99dea476 100755 --- a/test/segments/symfony_version.spec +++ b/test/segments/symfony_version.spec @@ -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 diff --git a/test/segments/todo.spec b/test/segments/todo.spec index 1dae9a68..7f1d7fba 100755 --- a/test/segments/todo.spec +++ b/test/segments/todo.spec @@ -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)" } diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec index 3ae4077e..f78012dd 100755 --- a/test/segments/vcs-git.spec +++ b/test/segments/vcs-git.spec @@ -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 diff --git a/test/segments/vcs-hg.spec b/test/segments/vcs-hg.spec index 91d25ae6..3074952a 100755 --- a/test/segments/vcs-hg.spec +++ b/test/segments/vcs-hg.spec @@ -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)" } diff --git a/test/segments/vi_mode.spec b/test/segments/vi_mode.spec index 205c38b7..5bed38bd 100755 --- a/test/segments/vi_mode.spec +++ b/test/segments/vi_mode.spec @@ -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)" } -- cgit v1.2.3 From 81fd69ae98337c20cb3e530d4efe13bec2fb3b20 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 4 Aug 2018 17:34:52 +0200 Subject: Update shunit2 to newest version --- shunit2 | 2 +- test/core/color_overriding.spec | 2 +- test/core/joining_segments.spec | 2 +- test/core/prompt.spec | 2 +- test/core/visual_identifier.spec | 2 +- test/functions/colors.spec | 2 +- test/functions/icons.spec | 2 +- test/functions/utilities.spec | 2 +- test/powerlevel9k.spec | 2 +- test/segments/anaconda.spec | 2 +- test/segments/aws_eb_env.spec | 2 +- test/segments/background_jobs.spec | 2 +- test/segments/battery.spec | 2 +- test/segments/command_execution_time.spec | 2 +- test/segments/context.spec | 2 +- test/segments/custom.spec | 2 +- test/segments/detect_virt.spec | 2 +- test/segments/dir.spec | 2 +- test/segments/disk_usage.spec | 2 +- test/segments/go_version.spec | 2 +- test/segments/ip.spec | 2 +- test/segments/kubecontext.spec | 2 +- test/segments/laravel_version.spec | 2 +- test/segments/load.spec | 2 +- test/segments/node_version.spec | 2 +- test/segments/nodeenv.spec | 2 +- test/segments/nvm.spec | 2 +- test/segments/php_version.spec | 2 +- test/segments/public_ip.spec | 2 +- test/segments/ram.spec | 2 +- test/segments/rust_version.spec | 2 +- test/segments/ssh.spec | 2 +- test/segments/status.spec | 2 +- test/segments/swap.spec | 2 +- test/segments/swift_version.spec | 2 +- test/segments/symfony_version.spec | 2 +- test/segments/todo.spec | 2 +- test/segments/vcs-git.spec | 2 +- test/segments/vcs-hg.spec | 2 +- test/segments/vi_mode.spec | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) (limited to 'test/segments/todo.spec') diff --git a/shunit2 b/shunit2 index 60dd60bc..07bb3292 160000 --- a/shunit2 +++ b/shunit2 @@ -1 +1 @@ -Subproject commit 60dd60bcd1573befe38465010263ab242e55811d +Subproject commit 07bb3292048a4982aad7247bdd7890f2bf532ece diff --git a/test/core/color_overriding.spec b/test/core/color_overriding.spec index ead890d7..48b30f00 100755 --- a/test/core/color_overriding.spec +++ b/test/core/color_overriding.spec @@ -59,4 +59,4 @@ function testColorOverridingOfCustomSegment() { assertEquals "%K{red} %F{green%}CW %f%F{red}world %k%F{red}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/core/joining_segments.spec b/test/core/joining_segments.spec index 708e9bf1..f224007e 100755 --- a/test/core/joining_segments.spec +++ b/test/core/joining_segments.spec @@ -184,4 +184,4 @@ function testRightJoiningBuiltinSegmentWorks() { unalias php } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/core/prompt.spec b/test/core/prompt.spec index 42518f06..dd5bba58 100755 --- a/test/core/prompt.spec +++ b/test/core/prompt.spec @@ -101,4 +101,4 @@ function testPrefixingSecondLineOnLeftPrompt() { assertEquals "╭─%f%b%k%K{white} %F{black}world1 %k%F{white}%f ${nl}XXX" "${(e)PROMPT}" } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/core/visual_identifier.spec b/test/core/visual_identifier.spec index db9896db..c6b1125b 100755 --- a/test/core/visual_identifier.spec +++ b/test/core/visual_identifier.spec @@ -47,4 +47,4 @@ function testVisualIdentifierPrintsNothingIfNotAvailable() { assertEquals "%K{white} %F{black}world1 %k%F{white}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/functions/colors.spec b/test/functions/colors.spec index 61a40087..bb06b719 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -39,4 +39,4 @@ function testIsSameColorDoesNotYieldNotEqualColorsTruthy() { } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/functions/icons.spec b/test/functions/icons.spec index d4ddc805..ec0cb1fa 100755 --- a/test/functions/icons.spec +++ b/test/functions/icons.spec @@ -470,4 +470,4 @@ function testAllIconsAreDefinedLikeInNerdfontCompleteMode() { unset _ICONS_UNDER_TEST } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/functions/utilities.spec b/test/functions/utilities.spec index a9bd67e3..b727c1f6 100755 --- a/test/functions/utilities.spec +++ b/test/functions/utilities.spec @@ -106,4 +106,4 @@ function testSegmentShouldNotBeJoinedIfPredecessingSegmentIsNotJoinedButConditio unset segments } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/powerlevel9k.spec b/test/powerlevel9k.spec index 57f85c98..8de0f1e2 100755 --- a/test/powerlevel9k.spec +++ b/test/powerlevel9k.spec @@ -120,4 +120,4 @@ function testNewlineOnRpromptCanBeDisabled() { assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX) world  $(print_icon MULTILINE_LAST_PROMPT_PREFIX) rworld' "$(print -P ${PROMPT}${RPROMPT})" } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/anaconda.spec b/test/segments/anaconda.spec index 2aa8d272..c35f0494 100755 --- a/test/segments/anaconda.spec +++ b/test/segments/anaconda.spec @@ -66,4 +66,4 @@ function testAnacondaSegmentWorks() { 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 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec index 42740ea6..92240e42 100755 --- a/test/segments/aws_eb_env.spec +++ b/test/segments/aws_eb_env.spec @@ -58,4 +58,4 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec cd - } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/background_jobs.spec b/test/segments/background_jobs.spec index 0a61c3e1..fa8d5ce6 100755 --- a/test/segments/background_jobs.spec +++ b/test/segments/background_jobs.spec @@ -75,4 +75,4 @@ function testBackgroundJobsSegmentWithVerboseMode() { unfunction jobs } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/battery.spec b/test/segments/battery.spec index 835e1468..4f81eaec 100755 --- a/test/segments/battery.spec +++ b/test/segments/battery.spec @@ -170,4 +170,4 @@ function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() { assertEquals "%K{black} %F{white%}🔋 %f%F{white}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/command_execution_time.spec b/test/segments/command_execution_time.spec index 65623a00..b47d3fc9 100755 --- a/test/segments/command_execution_time.spec +++ b/test/segments/command_execution_time.spec @@ -101,4 +101,4 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() { assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}02:00:00 %k%F{red}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/context.spec b/test/segments/context.spec index 2cef90dd..0805474f 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -103,4 +103,4 @@ function testContextSegmentIsShownIfForced() { assertEquals "%K{black} %F{yellow}$(whoami) %k%F{black}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/custom.spec b/test/segments/custom.spec index b7719d1c..3062d2e5 100755 --- a/test/segments/custom.spec +++ b/test/segments/custom.spec @@ -83,4 +83,4 @@ function testSettingVisualIdentifierForegroundColorForCustomSegment() { assertEquals "%K{white} %F{red%}hw %f%F{black}world %k%F{white}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/detect_virt.spec b/test/segments/detect_virt.spec index 7df92a24..f5c54198 100755 --- a/test/segments/detect_virt.spec +++ b/test/segments/detect_virt.spec @@ -80,4 +80,4 @@ function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() { unalias systemd-detect-virt } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 1f0440cd..09fa8505 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -768,4 +768,4 @@ function testDirSeparatorColorRootSubSubdirWorks() { rm -fr /tmp/powerlevel9k-test } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/disk_usage.spec b/test/segments/disk_usage.spec index ece19bb5..80fc996f 100755 --- a/test/segments/disk_usage.spec +++ b/test/segments/disk_usage.spec @@ -128,4 +128,4 @@ function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() { unfunction df } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/go_version.spec b/test/segments/go_version.spec index 6d8f13b9..6260aaf5 100755 --- a/test/segments/go_version.spec +++ b/test/segments/go_version.spec @@ -85,4 +85,4 @@ function testGoSegmentPrintsNothingIfGoIsNotAvailable() { unalias go } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/ip.spec b/test/segments/ip.spec index 190953ad..8ffb41eb 100755 --- a/test/segments/ip.spec +++ b/test/segments/ip.spec @@ -228,4 +228,4 @@ inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 unfunction ip } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/kubecontext.spec b/test/segments/kubecontext.spec index 746ab806..b954de4a 100755 --- a/test/segments/kubecontext.spec +++ b/test/segments/kubecontext.spec @@ -101,4 +101,4 @@ function testKubeContextPrintsNothingIfKubectlNotAvailable() { unalias kubectl } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/laravel_version.spec b/test/segments/laravel_version.spec index f4fd704d..88818c6a 100755 --- a/test/segments/laravel_version.spec +++ b/test/segments/laravel_version.spec @@ -68,4 +68,4 @@ function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() { unalias php } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/load.spec b/test/segments/load.spec index f7c1b9be..9caa82c3 100755 --- a/test/segments/load.spec +++ b/test/segments/load.spec @@ -146,4 +146,4 @@ function testLoadSegmentCriticalState() { unalias nproc } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/node_version.spec b/test/segments/node_version.spec index d003f5c3..1627f436 100755 --- a/test/segments/node_version.spec +++ b/test/segments/node_version.spec @@ -38,4 +38,4 @@ function testNodeVersionSegmentWorks() { unfunction node } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/nodeenv.spec b/test/segments/nodeenv.spec index aff22586..b72b426a 100755 --- a/test/segments/nodeenv.spec +++ b/test/segments/nodeenv.spec @@ -96,4 +96,4 @@ function testNodeenvSegmentWorks() { unset NODE_VIRTUAL_ENV } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/nvm.spec b/test/segments/nvm.spec index c8e99ea3..83d4c8f6 100755 --- a/test/segments/nvm.spec +++ b/test/segments/nvm.spec @@ -69,4 +69,4 @@ function testNvmSegmentPrintsNothingWhenOnDefaultVersion() { assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/php_version.spec b/test/segments/php_version.spec index 4b9ab753..1a3ec91b 100755 --- a/test/segments/php_version.spec +++ b/test/segments/php_version.spec @@ -39,4 +39,4 @@ Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies unalias php } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/public_ip.spec b/test/segments/public_ip.spec index c4b2ae88..9a2dcdab 100755 --- a/test/segments/public_ip.spec +++ b/test/segments/public_ip.spec @@ -219,4 +219,4 @@ function testPublicIpSegmentWhenGoingOnline() { unfunction dig } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/ram.spec b/test/segments/ram.spec index dc0b6c6b..f1331427 100755 --- a/test/segments/ram.spec +++ b/test/segments/ram.spec @@ -63,4 +63,4 @@ function testRamSegmentWorksOnLinux() { assertEquals "%K{yellow} %F{black%}RAM %f%F{black}0.29G " "$(prompt_ram left 1 false ${FOLDER})" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/rust_version.spec b/test/segments/rust_version.spec index 583807a6..9643125f 100755 --- a/test/segments/rust_version.spec +++ b/test/segments/rust_version.spec @@ -48,4 +48,4 @@ function testRustPrintsNothingIfRustIsNotAvailable() { assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 +source shunit2/shunit2 diff --git a/test/segments/ssh.spec b/test/segments/ssh.spec index a6701dcf..36971e13 100755 --- a/test/segments/ssh.spec +++ b/test/segments/ssh.spec @@ -77,4 +77,4 @@ function testSshSegmentWorksIfAllNecessaryVariablesAreSet() { unset SSH_CLIENT } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/status.spec b/test/segments/status.spec index b3ba3e36..97dc6b31 100755 --- a/test/segments/status.spec +++ b/test/segments/status.spec @@ -110,4 +110,4 @@ function testStatusSegmentIntegrated() { assertEquals "%f%b%k%K{black} %F{red%}✘%f %k%F{black}%f " "${(e)PROMPT}" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/swap.spec b/test/segments/swap.spec index 20a2d40a..2f4fbbf1 100755 --- a/test/segments/swap.spec +++ b/test/segments/swap.spec @@ -55,4 +55,4 @@ function testSwapSegmentWorksOnLinux() { assertEquals "%K{yellow} %F{black%}SWP %f%F{black}0.95G " "$(prompt_swap left 1 false ${FOLDER})" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/swift_version.spec b/test/segments/swift_version.spec index da9aaa92..4b7c6351 100755 --- a/test/segments/swift_version.spec +++ b/test/segments/swift_version.spec @@ -54,4 +54,4 @@ function testSwiftSegmentWorks() { unfunction swift } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/symfony_version.spec b/test/segments/symfony_version.spec index 99dea476..89a2e0be 100755 --- a/test/segments/symfony_version.spec +++ b/test/segments/symfony_version.spec @@ -114,4 +114,4 @@ function testSymfonyVersionSegmentWorksInNestedFolder() { unfunction php } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/todo.spec b/test/segments/todo.spec index 7f1d7fba..488dc993 100755 --- a/test/segments/todo.spec +++ b/test/segments/todo.spec @@ -55,4 +55,4 @@ function testTodoSegmentWorksAsExpected() { assertEquals "%K{244} %F{black%}☑ %f%F{black}100 %k%F{grey50}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec index f78012dd..b84e08d9 100755 --- a/test/segments/vcs-git.spec +++ b/test/segments/vcs-git.spec @@ -375,4 +375,4 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { assertEquals "%K{green} %F{black} master %k%F{green}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/vcs-hg.spec b/test/segments/vcs-hg.spec index 3074952a..ff84a3d6 100755 --- a/test/segments/vcs-hg.spec +++ b/test/segments/vcs-hg.spec @@ -204,4 +204,4 @@ function testBookmarkIconWorks() { assertEquals "%K{green} %F{black} default Binitial %k%F{green}%f " "$(build_left_prompt)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/vi_mode.spec b/test/segments/vi_mode.spec index 5bed38bd..8913dfea 100755 --- a/test/segments/vi_mode.spec +++ b/test/segments/vi_mode.spec @@ -45,4 +45,4 @@ function testViInsertModeStringIsCustomizable() { assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)" } -source shunit2/source/2.1/src/shunit2 \ No newline at end of file +source shunit2/shunit2 \ No newline at end of file -- cgit v1.2.3 From df0c2198a0a7cb523c3d3428e1d70cb49018cd60 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Fri, 17 Aug 2018 18:53:26 +0200 Subject: Fix tests --- test/core/color_overriding.spec | 10 ++-- test/core/joining_segments.spec | 28 +++++------ test/core/prompt.spec | 10 ++-- test/core/visual_identifier.spec | 10 ++-- test/functions/colors.spec | 6 +-- test/powerlevel9k.spec | 14 +++--- test/segments/anaconda.spec | 8 +-- test/segments/aws_eb_env.spec | 2 +- test/segments/background_jobs.spec | 8 +-- test/segments/battery.spec | 22 ++++----- test/segments/command_execution_time.spec | 14 +++--- test/segments/context.spec | 14 +++--- test/segments/custom.spec | 12 ++--- test/segments/detect_virt.spec | 8 +-- test/segments/dir.spec | 82 +++++++++++++++---------------- test/segments/disk_usage.spec | 12 ++--- test/segments/go_version.spec | 6 +-- test/segments/ip.spec | 16 +++--- test/segments/kubecontext.spec | 6 +-- test/segments/laravel_version.spec | 6 +-- test/segments/load.spec | 4 +- test/segments/node_version.spec | 4 +- test/segments/nodeenv.spec | 6 +-- test/segments/nvm.spec | 6 +-- test/segments/php_version.spec | 2 +- test/segments/public_ip.spec | 26 +++++----- test/segments/ram.spec | 6 +-- test/segments/rust_version.spec | 2 +- test/segments/ssh.spec | 8 +-- test/segments/status.spec | 12 ++--- test/segments/swap.spec | 4 +- test/segments/swift_version.spec | 4 +- test/segments/symfony_version.spec | 6 +-- test/segments/todo.spec | 2 +- test/segments/vcs-git.spec | 12 ++--- test/segments/vcs-hg.spec | 8 +-- test/segments/vi_mode.spec | 8 +-- 37 files changed, 207 insertions(+), 207 deletions(-) (limited to 'test/segments/todo.spec') diff --git a/test/core/color_overriding.spec b/test/core/color_overriding.spec index d3ed56ba..f2c3d891 100755 --- a/test/core/color_overriding.spec +++ b/test/core/color_overriding.spec @@ -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{001} %F{000}date-icon %f%F{000}%D{%d.%m.%y} %k%F{001}%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{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{007}%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{002}date-icon %f%F{009}%D{%d.%m.%y} %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{002}date-icon %f%F{001}%D{%d.%m.%y} %k%F{003}%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{001} %F{002}ssh-icon %f%F{002}%m %k%F{001}%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{002}CW %f%F{009}world %k%F{009}%f " "$(build_left_prompt)" + assertEquals "%K{001} %F{002}CW %f%F{001}world %k%F{001}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/core/joining_segments.spec b/test/core/joining_segments.spec index 42bf84dd..18213a52 100755 --- a/test/core/joining_segments.spec +++ b/test/core/joining_segments.spec @@ -21,7 +21,7 @@ function testLeftNormalSegmentsShouldNotBeJoined() { local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world2 %K{015}%F{000} %F{000}world4 %K{015}%F{000} %F{000}world6 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world2 %K{007}%F{000} %F{000}world4 %K{007}%F{000} %F{000}world6 %k%F{007}%f " "$(build_left_prompt)" } function testLeftJoinedSegments() { @@ -30,7 +30,7 @@ function testLeftJoinedSegments() { local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %k%F{007}%f " "$(build_left_prompt)" } function testLeftTransitiveJoinedSegments() { @@ -40,7 +40,7 @@ function testLeftTransitiveJoinedSegments() { local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world3 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world3 %k%F{007}%f " "$(build_left_prompt)" } function testLeftTransitiveJoiningWithConditionalJoinedSegment() { @@ -51,7 +51,7 @@ function testLeftTransitiveJoiningWithConditionalJoinedSegment() { local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world4 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world4 %k%F{007}%f " "$(build_left_prompt)" } function testLeftPromotingSegmentWithConditionalPredecessor() { @@ -61,7 +61,7 @@ function testLeftPromotingSegmentWithConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world3 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world3 %k%F{007}%f " "$(build_left_prompt)" } function testLeftPromotingSegmentWithJoinedConditionalPredecessor() { @@ -72,7 +72,7 @@ function testLeftPromotingSegmentWithJoinedConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %k%F{007}%f " "$(build_left_prompt)" } function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() { @@ -85,7 +85,7 @@ function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" - assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %K{015}%F{000}%F{000}world6 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %K{007}%F{000}%F{000}world6 %k%F{007}%f " "$(build_left_prompt)" } function testLeftJoiningBuiltinSegmentWorks() { @@ -108,7 +108,7 @@ function testRightNormalSegmentsShouldNotBeJoined() { local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2 %f%F{000}%f%K{015}%F{000} world4 %f%F{000}%f%K{015}%F{000} world6%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2 %f%F{000}%f%K{007}%F{000} world4 %f%F{000}%f%K{007}%F{000} world6%E" "$(build_right_prompt)" } function testRightJoinedSegments() { @@ -117,7 +117,7 @@ function testRightJoinedSegments() { local POWERLEVEL9K_CUSTOM_WORLD1="echo world1" local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2%E" "$(build_right_prompt)" } function testRightTransitiveJoinedSegments() { @@ -127,7 +127,7 @@ function testRightTransitiveJoinedSegments() { local POWERLEVEL9K_CUSTOM_WORLD2="echo world2" local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world3%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world3%E" "$(build_right_prompt)" } function testRightTransitiveJoiningWithConditionalJoinedSegment() { @@ -138,7 +138,7 @@ function testRightTransitiveJoiningWithConditionalJoinedSegment() { local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world4%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world4%E" "$(build_right_prompt)" } function testRightPromotingSegmentWithConditionalPredecessor() { @@ -148,7 +148,7 @@ function testRightPromotingSegmentWithConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD3="echo world3" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world3%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world3%E" "$(build_right_prompt)" } function testRightPromotingSegmentWithJoinedConditionalPredecessor() { @@ -159,7 +159,7 @@ function testRightPromotingSegmentWithJoinedConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD4="echo world4" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4%E" "$(build_right_prompt)" } function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() { @@ -172,7 +172,7 @@ function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() { local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions local POWERLEVEL9K_CUSTOM_WORLD6="echo world6" - assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4 %f%K{015}%F{000}world6%E" "$(build_right_prompt)" + assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4 %f%K{007}%F{000}world6%E" "$(build_right_prompt)" } function testRightJoiningBuiltinSegmentWorks() { diff --git a/test/core/prompt.spec b/test/core/prompt.spec index b0d63cbb..47d3ac7b 100755 --- a/test/core/prompt.spec +++ b/test/core/prompt.spec @@ -22,7 +22,7 @@ function testSegmentOnRightSide() { powerlevel9k_prepare_prompts local reset_attributes=$'\e[00m' - assertEquals "%f%b%k%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}" + assertEquals "%f%b%k%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}" } function testDisablingRightPrompt() { @@ -48,7 +48,7 @@ function testLeftMultilinePrompt() { powerlevel9k_prepare_prompts local nl=$'\n' - assertEquals "╭─%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}╰─ " "${(e)PROMPT}" + assertEquals "╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ " "${(e)PROMPT}" } function testRightPromptOnSameLine() { @@ -70,7 +70,7 @@ function testRightPromptOnSameLine() { startSkipping powerlevel9k_prepare_prompts - assertEquals "%{\e[1A%}%F{015}%f%K{015}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}" + assertEquals "%{\e[1A%}%F{007}%f%K{007}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}" } function testPrefixingFirstLineOnLeftPrompt() { @@ -84,7 +84,7 @@ function testPrefixingFirstLineOnLeftPrompt() { powerlevel9k_prepare_prompts local nl=$'\n' - assertEquals "XXX%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}╰─ " "${(e)PROMPT}" + assertEquals "XXX%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}╰─ " "${(e)PROMPT}" } function testPrefixingSecondLineOnLeftPrompt() { @@ -98,7 +98,7 @@ function testPrefixingSecondLineOnLeftPrompt() { powerlevel9k_prepare_prompts local nl=$'\n' - assertEquals "╭─%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}XXX" "${(e)PROMPT}" + assertEquals "╭─%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}XXX" "${(e)PROMPT}" } source shunit2/shunit2 diff --git a/test/core/visual_identifier.spec b/test/core/visual_identifier.spec index c31f8dac..c6c6bef5 100755 --- a/test/core/visual_identifier.spec +++ b/test/core/visual_identifier.spec @@ -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{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%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{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%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{007}%f%K{007}%F{000} world1%F{000} icon-here%f%E" "$(build_right_prompt)" } function testVisualIdentifierPrintsNothingIfNotAvailable() { @@ -44,7 +44,7 @@ function testVisualIdentifierPrintsNothingIfNotAvailable() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1) local POWERLEVEL9K_CUSTOM_WORLD1='echo world1' - assertEquals "%K{015} %F{000}world1 %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world1 %k%F{007}%f " "$(build_left_prompt)" } function testVisualIdentifierIsPrintedInNumericalColorCode() { @@ -54,7 +54,7 @@ function testVisualIdentifierIsPrintedInNumericalColorCode() { 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)" + assertEquals "%K{007} %F{056}xxx %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/functions/colors.spec b/test/functions/colors.spec index ce777913..4ee71205 100755 --- a/test/functions/colors.spec +++ b/test/functions/colors.spec @@ -59,9 +59,9 @@ function testBrightColorsWork() { # with normal ones. This code is now gone, and this test should # ensure that all input channels for bright colors are handled # correctly. - assertTrue "isSameColor 'cyan' '014'" - assertEquals '014' "$(getColorCode 'cyan')" - assertEquals '014' "$(getColor 'cyan')" + assertTrue "isSameColor 'cyan' '006'" + assertEquals '006' "$(getColorCode 'cyan')" + assertEquals '006' "$(getColor 'cyan')" } source shunit2/shunit2 diff --git a/test/powerlevel9k.spec b/test/powerlevel9k.spec index 40fd17ca..37aa2704 100755 --- a/test/powerlevel9k.spec +++ b/test/powerlevel9k.spec @@ -21,7 +21,7 @@ function testJoinedSegments() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined) cd /tmp - assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -31,7 +31,7 @@ function testTransitiveJoinedSegments() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined) cd /tmp - assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000}%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -41,7 +41,7 @@ function testJoiningWithConditionalSegment() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined) cd /tmp - assertEquals "%K{012} %F{000}/tmp %K{012}%F{000} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %K{004}%F{000} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -52,7 +52,7 @@ function testDynamicColoringOfSegmentsWork() { local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red' cd /tmp - assertEquals "%K{009} %F{000}/tmp %k%F{009}%f " "$(build_left_prompt)" + assertEquals "%K{001} %F{000}/tmp %k%F{001}%f " "$(build_left_prompt)" cd - } @@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() { cd /tmp - assertEquals "%K{012} %F{002}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{002}icon-here %f%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -84,7 +84,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() { cd /tmp - assertEquals "%K{011} %F{002}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{002}icon-here %f%F{001}/tmp %k%F{003}%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{004} %F{000}icon-here %f%F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd - # rm -fr ~/$testFolder diff --git a/test/segments/anaconda.spec b/test/segments/anaconda.spec index 92e1ea64..efcfc030 100755 --- a/test/segments/anaconda.spec +++ b/test/segments/anaconda.spec @@ -21,7 +21,7 @@ function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() { unset CONDA_ENV_PATH unset CONDA_PREFIX - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() { @@ -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{004} %F{000}icon-here %f%F{000}(tmp) %k%F{004}%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{004} %F{000}icon-here %f%F{000}(test) %k%F{004}%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{004} %F{000}icon-here %f%F{000}(tmptest) %k%F{004}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec index 8aaf9cc6..99b418e0 100755 --- a/test/segments/aws_eb_env.spec +++ b/test/segments/aws_eb_env.spec @@ -17,7 +17,7 @@ function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() { diff --git a/test/segments/background_jobs.spec b/test/segments/background_jobs.spec index 56f8b4d8..3d83e171 100755 --- a/test/segments/background_jobs.spec +++ b/test/segments/background_jobs.spec @@ -18,7 +18,7 @@ function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias jobs } @@ -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{006}⚙%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{006}⚙%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{006}⚙ %f%F{006}3 %k%F{000}%f " "$(build_left_prompt)" unfunction jobs } diff --git a/test/segments/battery.spec b/test/segments/battery.spec index 201f4a79..79e25d6f 100755 --- a/test/segments/battery.spec +++ b/test/segments/battery.spec @@ -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{001}🔋 %f%F{001}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{003}🔋 %f%F{003}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{007}🔋 %f%F{007}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{003}🔋 %f%F{003}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})" } function testBatterySegmentIfBatteryIsFullOnOSX() { @@ -109,35 +109,35 @@ 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{007}🔋 %f%F{007}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{001}🔋 %f%F{001}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{003}🔋 %f%F{003}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{007}🔋 %f%F{007}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{003}🔋 %f%F{003}10%% " "$(prompt_battery left 1 false ${FOLDER})" } function testBatterySegmentIfBatteryIsFullOnLinux() { @@ -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{007}🔋 %f%F{007}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{007}🔋 %f%F{007}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/command_execution_time.spec b/test/segments/command_execution_time.spec index 2a782859..b7c3fae0 100755 --- a/test/segments/command_execution_time.spec +++ b/test/segments/command_execution_time.spec @@ -20,7 +20,7 @@ function testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() { # Override payload local _P9K_COMMAND_DURATION=2 - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testCommandExecutionTimeThresholdCouldBeChanged() { @@ -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{001} %F{226}Dur %f%F{226}2.03 %k%F{001}%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{001} %F{226}Dur %f%F{226}0.03 %k%F{001}%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{001} %F{226}Dur %f%F{226}0.0001 %k%F{001}%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{001} %F{226}Dur %f%F{226}23 %k%F{001}%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{001} %F{226}Dur %f%F{226}03:00 %k%F{001}%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{001} %F{226}Dur %f%F{226}02:00:00 %k%F{001}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/context.spec b/test/segments/context.spec index 23da0f2d..07300370 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -29,7 +29,7 @@ function testContextSegmentDoesNotGetRenderedWithDefaultUser() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { @@ -43,7 +43,7 @@ function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" unfunction sudo } @@ -58,7 +58,7 @@ function testContextSegmentWithForeignUser() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" unfunction sudo } @@ -72,7 +72,7 @@ function testContextSegmentWithRootUser() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" } function testOverridingContextTemplate() { @@ -83,7 +83,7 @@ function testOverridingContextTemplate() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}xx %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}xx %k%F{000}%f " "$(build_left_prompt)" } function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { @@ -95,7 +95,7 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}%n@%m %k%F{000}%f " "$(build_left_prompt)" } function testContextSegmentIsShownIfForced() { @@ -107,7 +107,7 @@ function testContextSegmentIsShownIfForced() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}$(whoami) %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}$(whoami) %k%F{000}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/custom.spec b/test/segments/custom.spec index 4dbb11be..0f66c82f 100755 --- a/test/segments/custom.spec +++ b/test/segments/custom.spec @@ -17,7 +17,7 @@ function testCustomDirectOutputSegment() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testCustomClosureSegment() { @@ -31,7 +31,7 @@ function testCustomClosureSegment() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testSettingBackgroundForCustomSegment() { @@ -43,7 +43,7 @@ function testSettingBackgroundForCustomSegment() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000}world %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000}world %k%F{003}%f " "$(build_left_prompt)" } function testSettingForegroundForCustomSegment() { @@ -55,7 +55,7 @@ function testSettingForegroundForCustomSegment() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{009}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{001}world %k%F{007}%f " "$(build_left_prompt)" } function testSettingVisualIdentifierForCustomSegment() { @@ -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{007} %F{000}hw %f%F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testSettingVisualIdentifierForegroundColorForCustomSegment() { @@ -80,7 +80,7 @@ function testSettingVisualIdentifierForegroundColorForCustomSegment() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{009}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{001}hw %f%F{000}world %k%F{007}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/detect_virt.spec b/test/segments/detect_virt.spec index e0ca80e7..910f52eb 100755 --- a/test/segments/detect_virt.spec +++ b/test/segments/detect_virt.spec @@ -20,7 +20,7 @@ function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias systemd-detect-virt } @@ -33,7 +33,7 @@ function testDetectVirtSegmentIfSystemdReturnsPlainName() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{011}xxx %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}xxx %k%F{000}%f " "$(build_left_prompt)" unalias systemd-detect-virt } @@ -53,7 +53,7 @@ function testDetectVirtSegmentIfRootFsIsOnExpectedInode() { # which translates to: Show the inode number of "/" and test if it is "2". alias ls="echo '2'" - assertEquals "%K{000} %F{011}none %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}none %k%F{000}%f " "$(build_left_prompt)" unalias ls unalias systemd-detect-virt @@ -74,7 +74,7 @@ function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() { # which translates to: Show the inode number of "/" and test if it is "2". alias ls="echo '3'" - assertEquals "%K{000} %F{011}chroot %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{003}chroot %k%F{000}%f " "$(build_left_prompt)" unalias ls unalias systemd-detect-virt diff --git a/test/segments/dir.spec b/test/segments/dir.spec index d43545b4..7e65cb71 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -29,9 +29,9 @@ function testDirPathAbsoluteWorks() { # of /home or /Users path.. That is why we change the test # according to the OS of the host. if [[ "${OS}" == 'Linux' ]]; then - assertEquals "%K{012} %F{000}/home/${USER} %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/home/${USER} %k%F{004}%f " "$(build_left_prompt)" elif [[ "${OS}" == 'OSX' ]]; then - assertEquals "%K{012} %F{000}/Users/${USER} %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/Users/${USER} %k%F{004}%f " "$(build_left_prompt)" fi cd - @@ -50,7 +50,7 @@ function testTruncateFoldersWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}…/12345678/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}…/12345678/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -72,7 +72,7 @@ function testTruncateFolderWithHomeDirWorks() { # Switch back to home folder as this causes the problem. cd .. - assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~ %k%F{004}%f " "$(build_left_prompt)" rmdir $FOLDER cd ${CURRENT_DIR} @@ -91,7 +91,7 @@ function testTruncateMiddleWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -110,7 +110,7 @@ function testTruncationFromRightWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -129,7 +129,7 @@ function testTruncateToLastWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -148,7 +148,7 @@ function testTruncateToFirstAndLastWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -167,7 +167,7 @@ function testTruncateAbsoluteWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}…89 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}…89 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -187,7 +187,7 @@ function testTruncationFromRightWithEmptyDelimiter() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -207,7 +207,7 @@ function testTruncateWithFolderMarkerWorks() { # Setup folder marker touch $BASEFOLDER/1/12/.shorten_folder_marker cd $FOLDER - assertEquals "%K{012} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $BASEFOLDER @@ -228,7 +228,7 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() { # Setup folder marker touch $BASEFOLDER/1/12/.xxx cd $FOLDER - assertEquals "%K{012} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $BASEFOLDER @@ -260,7 +260,7 @@ function testTruncateWithPackageNameWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder @@ -300,7 +300,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}My_Package/as…/qwerqwer %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}My_Package/as…/qwerqwer %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder @@ -336,7 +336,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}My_Package/.g…/re…/heads %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}My_Package/.g…/re…/heads %k%F{004}%f " "$(build_left_prompt)" # Go back cd $p9kFolder @@ -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{004} %F{000}home-icon %f%F{000}~ %k%F{004}%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{004} %F{000}sub-icon %f%F{000}~/powerlevel9k-test %k%F{004}%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{004} %F{000}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr $FOLDER @@ -403,7 +403,7 @@ function testChangingDirPathSeparator() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{012} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -421,7 +421,7 @@ function testHomeFolderAbbreviation() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~ %k%F{004}%f " "$(build_left_prompt)" # substituted local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' @@ -429,7 +429,7 @@ function testHomeFolderAbbreviation() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}qQq %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}qQq %k%F{004}%f " "$(build_left_prompt)" cd /tmp # default @@ -438,7 +438,7 @@ function testHomeFolderAbbreviation() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" # substituted local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' @@ -446,7 +446,7 @@ function testHomeFolderAbbreviation() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp %k%F{004}%f " "$(build_left_prompt)" cd "$dir" } @@ -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{004} %F{000}folder-icon %f%F{000}tmp %k%F{004}%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{004} %F{000}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -507,7 +507,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{012} %F{000}xXx1xXx2 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}xXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -527,7 +527,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{012} %F{000}tmpxXxpo…stxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}tmpxXxpo…stxXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -547,7 +547,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat mkdir -p /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2 - assertEquals "%K{012} %F{000}tmpxXxpo…xXx1xXx2 %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}tmpxXxpo…xXx1xXx2 %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -570,7 +570,7 @@ function testTruncateToUniqueWorks() { mkdir -p /tmp/powerlevel9k-test/bob/docs cd /tmp/powerlevel9k-test/alice/devl - assertEquals "%K{012} %F{000}txXxpxXxalxXxde %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}txXxpxXxalxXxde %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -586,7 +586,7 @@ function testBoldHomeDirWorks() { cd ~ - assertEquals "%K{012} %F{000}%B~%b %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%B~%b %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -602,7 +602,7 @@ function testBoldHomeSubdirWorks() { mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{012} %F{000}~/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~/%Bpowerlevel9k-test%b %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test @@ -618,7 +618,7 @@ function testBoldRootDirWorks() { cd / - assertEquals "%K{012} %F{000}%B/%b %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%B/%b %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -633,7 +633,7 @@ function testBoldRootSubdirWorks() { cd /tmp - assertEquals "%K{012} %F{000}/%Btmp%b %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/%Btmp%b %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -649,7 +649,7 @@ function testBoldRootSubSubdirWorks() { mkdir -p /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{012} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -665,7 +665,7 @@ function testHighlightHomeWorks() { cd ~ - assertEquals "%K{012} %F{000}%F{red}~ %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}~ %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -681,7 +681,7 @@ function testHighlightHomeSubdirWorks() { mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{012} %F{000}~/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~/%F{red}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test @@ -697,7 +697,7 @@ function testHighlightRootWorks() { cd / - assertEquals "%K{012} %F{000}%F{red}/ %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}/ %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -712,7 +712,7 @@ function testHighlightRootSubdirWorks() { cd /tmp - assertEquals "%K{012} %F{000}/%F{red}tmp %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/%F{red}tmp %k%F{004}%f " "$(build_left_prompt)" cd - } @@ -728,7 +728,7 @@ function testHighlightRootSubSubdirWorks() { mkdir /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{012} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -745,7 +745,7 @@ function testDirSeparatorColorHomeSubdirWorks() { mkdir -p ~/powerlevel9k-test cd ~/powerlevel9k-test - assertEquals "%K{012} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr ~/powerlevel9k-test @@ -762,7 +762,7 @@ function testDirSeparatorColorRootSubSubdirWorks() { mkdir -p /tmp/powerlevel9k-test cd /tmp/powerlevel9k-test - assertEquals "%K{012} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)" + assertEquals "%K{004} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{004}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test diff --git a/test/segments/disk_usage.spec b/test/segments/disk_usage.spec index 56bc402d..ebafe31d 100755 --- a/test/segments/disk_usage.spec +++ b/test/segments/disk_usage.spec @@ -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{001} %F{007}hdd %f%F{007}97%% %k%F{001}%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{003} %F{000}hdd %f%F{000}94%% %k%F{003}%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{003}hdd %f%F{003}4%% %k%F{000}%f " "$(build_left_prompt)" unfunction df } @@ -88,7 +88,7 @@ function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShoul local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true local POWERLEVEL9K_CUSTOM_WORLD='echo world' - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%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{003} %F{000}hdd %f%F{000}11%% %k%F{003}%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{001} %F{007}hdd %f%F{007}11%% %k%F{001}%f " "$(build_left_prompt)" unfunction df } diff --git a/test/segments/go_version.spec b/test/segments/go_version.spec index f619dfae..d7a1c2c9 100755 --- a/test/segments/go_version.spec +++ b/test/segments/go_version.spec @@ -56,7 +56,7 @@ function testGoSegmentPrintsNothingIfEmptyGopath() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testGoSegmentPrintsNothingIfNotInGopath() { @@ -68,7 +68,7 @@ function testGoSegmentPrintsNothingIfNotInGopath() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testGoSegmentPrintsNothingIfGoIsNotAvailable() { @@ -80,7 +80,7 @@ function testGoSegmentPrintsNothingIfGoIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias go } diff --git a/test/segments/ip.spec b/test/segments/ip.spec index cba4af16..254f11c9 100755 --- a/test/segments/ip.spec +++ b/test/segments/ip.spec @@ -19,7 +19,7 @@ function testIpSegmentPrintsNothingOnOsxIfNotConnected() { source powerlevel9k.zsh-theme local OS="OSX" # Fake OSX - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias networksetup } @@ -34,7 +34,7 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { source powerlevel9k.zsh-theme local OS="Linux" # Fake Linux - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias ip } @@ -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{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%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{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%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{006} %F{000}IP %f%F{000}1.2.3.4 %k%F{006}%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{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%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{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%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{006} %F{000}IP %f%F{000}10.0.2.15 %k%F{006}%f " "$(build_left_prompt)" unfunction ip } diff --git a/test/segments/kubecontext.spec b/test/segments/kubecontext.spec index 343c8937..76b35c34 100755 --- a/test/segments/kubecontext.spec +++ b/test/segments/kubecontext.spec @@ -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{005} %F{007}⎈ %f%F{007}minikube/default %k%F{005}%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{005} %F{007}⎈ %f%F{007}minikube/kube-system %k%F{005}%f " "$(build_left_prompt)" unalias kubectl } @@ -96,7 +96,7 @@ function testKubeContextPrintsNothingIfKubectlNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias kubectl } diff --git a/test/segments/laravel_version.spec b/test/segments/laravel_version.spec index 4c2f0f26..c4f09e58 100755 --- a/test/segments/laravel_version.spec +++ b/test/segments/laravel_version.spec @@ -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{009} %F{007}x %f%F{007}5.4.23 %k%F{009}%f " "$(build_left_prompt)" unalias php } @@ -49,7 +49,7 @@ function testLaravelVersionSegmentIfArtisanIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias php } @@ -64,7 +64,7 @@ function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias php } diff --git a/test/segments/load.spec b/test/segments/load.spec index 2ab7d23b..0f8ee332 100755 --- a/test/segments/load.spec +++ b/test/segments/load.spec @@ -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{003} %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{001} %F{000}L %f%F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})" unalias nproc } diff --git a/test/segments/node_version.spec b/test/segments/node_version.spec index b931082e..69b9cbb7 100755 --- a/test/segments/node_version.spec +++ b/test/segments/node_version.spec @@ -18,7 +18,7 @@ function testNodeVersionSegmentPrintsNothingWithoutNode() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias node } @@ -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{007}⬢ %f%F{007}1.2.3 %k%F{002}%f " "$(build_left_prompt)" unfunction node } diff --git a/test/segments/nodeenv.spec b/test/segments/nodeenv.spec index b16c577a..2e9d779e 100755 --- a/test/segments/nodeenv.spec +++ b/test/segments/nodeenv.spec @@ -23,7 +23,7 @@ function testNodeenvSegmentPrintsNothingWithoutNode() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias node } @@ -39,7 +39,7 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unfunction node } @@ -57,7 +57,7 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unset NODE_VIRTUAL_ENV_DISABLE_PROMPT unset NODE_VIRTUAL_ENV diff --git a/test/segments/nvm.spec b/test/segments/nvm.spec index eb58f83b..c9ed430d 100755 --- a/test/segments/nvm.spec +++ b/test/segments/nvm.spec @@ -37,7 +37,7 @@ function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testNvmSegmentWorksWithoutHavingADefaultAlias() { @@ -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{005} %F{000}⬢ %f%F{000}4.6.0 %k%F{005}%f " "$(build_left_prompt)" } function testNvmSegmentPrintsNothingWhenOnDefaultVersion() { @@ -66,7 +66,7 @@ function testNvmSegmentPrintsNothingWhenOnDefaultVersion() { [[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v4.6.0' } - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/php_version.spec b/test/segments/php_version.spec index 55f5bf71..6d64c570 100755 --- a/test/segments/php_version.spec +++ b/test/segments/php_version.spec @@ -18,7 +18,7 @@ function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias php } diff --git a/test/segments/public_ip.spec b/test/segments/public_ip.spec index 80c46ac5..334a6423 100755 --- a/test/segments/public_ip.spec +++ b/test/segments/public_ip.spec @@ -45,7 +45,7 @@ function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias dig } @@ -62,7 +62,7 @@ function testPublicIpSegmentPrintsNoticeIfNotConnected() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}disconnected %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}disconnected %k%F{000}%f " "$(build_left_prompt)" unalias dig } @@ -79,7 +79,7 @@ function testPublicIpSegmentWorksWithWget() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}wget 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}wget 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" unfunction wget unalias dig @@ -98,7 +98,7 @@ function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}curl 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}curl 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" unfunction curl unalias dig @@ -117,7 +117,7 @@ function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable( # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}dig 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}dig 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)" unfunction dig unalias curl @@ -134,14 +134,14 @@ function testPublicIpSegmentCachesFile() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" dig() { echo "second" } # Segment should not have changed! - assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" unfunction dig } @@ -157,7 +157,7 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" sleep 3 dig() { @@ -165,7 +165,7 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() { } # Segment should not have changed! - assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" unfunction dig } @@ -180,7 +180,7 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}first %k%F{000}%f " "$(build_left_prompt)" # Truncate cache file echo "" >! $POWERLEVEL9K_PUBLIC_IP_FILE @@ -190,7 +190,7 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() { } # Segment should not have changed! - assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" unfunction dig } @@ -205,7 +205,7 @@ function testPublicIpSegmentWhenGoingOnline() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}disconnected %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}disconnected %k%F{000}%f " "$(build_left_prompt)" unalias dig @@ -214,7 +214,7 @@ function testPublicIpSegmentWhenGoingOnline() { } # Segment should not have changed! - assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)" + assertEquals "%K{000} %F{007}second %k%F{000}%f " "$(build_left_prompt)" unfunction dig } diff --git a/test/segments/ram.spec b/test/segments/ram.spec index a3d97aa7..2c9f1693 100755 --- a/test/segments/ram.spec +++ b/test/segments/ram.spec @@ -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{003} %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{003} %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{003} %F{000}RAM %f%F{000}0.29G " "$(prompt_ram left 1 false ${FOLDER})" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/rust_version.spec b/test/segments/rust_version.spec index 007ca694..07331edb 100755 --- a/test/segments/rust_version.spec +++ b/test/segments/rust_version.spec @@ -45,7 +45,7 @@ function testRustPrintsNothingIfRustIsNotAvailable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } source shunit2/shunit2 diff --git a/test/segments/ssh.spec b/test/segments/ssh.spec index ad1b70fb..3245231f 100755 --- a/test/segments/ssh.spec +++ b/test/segments/ssh.spec @@ -22,7 +22,7 @@ function testSshSegmentPrintsNothingIfNoSshConnection() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testSshSegmentWorksIfOnlySshClientIsSet() { @@ -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{003}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{003}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{003}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)" unset SSH_TTY unset SSH_CLIENT diff --git a/test/segments/status.spec b/test/segments/status.spec index 1eba2b86..9fb34e09 100755 --- a/test/segments/status.spec +++ b/test/segments/status.spec @@ -24,7 +24,7 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() { @@ -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{001} %F{226}↵ %f%F{226}1 %k%F{001}%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{001} %F{226}↵ %f%F{226}0|0|1|0 %k%F{001}%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{001}✘%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{001} %F{226}↵ %f%F{226}SIGILL(4) %k%F{001}%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{001}✘%f %k%F{000}%f " "${(e)PROMPT}" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/swap.spec b/test/segments/swap.spec index 2ad5188d..7db5416b 100755 --- a/test/segments/swap.spec +++ b/test/segments/swap.spec @@ -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{003} %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{003} %F{000}SWP %f%F{000}0.95G " "$(prompt_swap left 1 false ${FOLDER})" } source shunit2/shunit2 \ No newline at end of file diff --git a/test/segments/swift_version.spec b/test/segments/swift_version.spec index 53074776..47fc0b7f 100755 --- a/test/segments/swift_version.spec +++ b/test/segments/swift_version.spec @@ -34,7 +34,7 @@ function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias swift } @@ -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{005} %F{007}Swift %f%F{007}3.0.1 %k%F{005}%f " "$(build_left_prompt)" unfunction swift } diff --git a/test/segments/symfony_version.spec b/test/segments/symfony_version.spec index 82618162..cb480724 100755 --- a/test/segments/symfony_version.spec +++ b/test/segments/symfony_version.spec @@ -34,7 +34,7 @@ function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unalias php } @@ -50,7 +50,7 @@ function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() { @@ -68,7 +68,7 @@ function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" unfunction php } diff --git a/test/segments/todo.spec b/test/segments/todo.spec index 14494454..875c45f8 100755 --- a/test/segments/todo.spec +++ b/test/segments/todo.spec @@ -38,7 +38,7 @@ function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{000}world %k%F{007}%f " "$(build_left_prompt)" } function testTodoSegmentWorksAsExpected() { diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec index 224d76e2..bddecf6c 100755 --- a/test/segments/vcs-git.spec +++ b/test/segments/vcs-git.spec @@ -76,7 +76,7 @@ function testColorOverridingForCleanStateWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{014} master %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{006} master %k%F{007}%f " "$(build_left_prompt)" } function testColorOverridingForModifiedStateWorks() { @@ -93,7 +93,7 @@ function testColorOverridingForModifiedStateWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{009} master ● %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{001} master ● %k%F{003}%f " "$(build_left_prompt)" } function testColorOverridingForUntrackedStateWorks() { @@ -107,7 +107,7 @@ function testColorOverridingForUntrackedStateWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{014} master ? %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{006} master ? %k%F{003}%f " "$(build_left_prompt)" } function testGitIconWorks() { @@ -194,7 +194,7 @@ function testStagedFilesIconWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000} master + %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000} master + %k%F{003}%f " "$(build_left_prompt)" } function testUnstagedFilesIconWorks() { @@ -211,7 +211,7 @@ function testUnstagedFilesIconWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000} master M %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000} master M %k%F{003}%f " "$(build_left_prompt)" } function testStashIconWorks() { @@ -289,7 +289,7 @@ function testActionHintWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000} master %F{red}| merge%f %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000} master %F{red}| merge%f %k%F{003}%f " "$(build_left_prompt)" } function testIncomingHintWorks() { diff --git a/test/segments/vcs-hg.spec b/test/segments/vcs-hg.spec index 27243fbe..2903f544 100755 --- a/test/segments/vcs-hg.spec +++ b/test/segments/vcs-hg.spec @@ -40,7 +40,7 @@ function testColorOverridingForCleanStateWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{015} %F{014} default %k%F{015}%f " "$(build_left_prompt)" + assertEquals "%K{007} %F{006} default %k%F{007}%f " "$(build_left_prompt)" } function testColorOverridingForModifiedStateWorks() { @@ -57,7 +57,7 @@ function testColorOverridingForModifiedStateWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{009} default ● %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{001} default ● %k%F{003}%f " "$(build_left_prompt)" } # There is no staging area in mercurial, therefore there are no "untracked" @@ -74,7 +74,7 @@ function testAddedFilesIconWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000} default ● %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000} default ● %k%F{003}%f " "$(build_left_prompt)" } # We don't support tagging in mercurial right now.. @@ -137,7 +137,7 @@ function testActionHintWorks() { # Load Powerlevel9k source ${P9K_HOME}/powerlevel9k.zsh-theme - assertEquals "%K{011} %F{000} default %F{red}| merging%f %k%F{011}%f " "$(build_left_prompt)" + assertEquals "%K{003} %F{000} default %F{red}| merging%f %k%F{003}%f " "$(build_left_prompt)" } function testShorteningCommitHashWorks() { diff --git a/test/segments/vi_mode.spec b/test/segments/vi_mode.spec index 8535cc4e..6a3a07b5 100755 --- a/test/segments/vi_mode.spec +++ b/test/segments/vi_mode.spec @@ -15,7 +15,7 @@ function testViInsertModeWorks() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)" + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" } function testViInsertModeWorksWhenLabeledAsMain() { @@ -24,7 +24,7 @@ function testViInsertModeWorksWhenLabeledAsMain() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)" + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" } function testViCommandModeWorks() { @@ -33,7 +33,7 @@ function testViCommandModeWorks() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{015}NORMAL " "$(prompt_vi_mode left 1 false)" + assertEquals "%K{000} %F{007}NORMAL " "$(prompt_vi_mode left 1 false)" } function testViInsertModeStringIsCustomizable() { @@ -42,7 +42,7 @@ function testViInsertModeStringIsCustomizable() { # Load Powerlevel9k source powerlevel9k.zsh-theme - assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)" + assertEquals "%K{000} %F{004}INSERT " "$(prompt_vi_mode left 1 false)" } source shunit2/shunit2 \ No newline at end of file -- cgit v1.2.3