aboutsummaryrefslogtreecommitdiff
path: root/test/functions
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-03-01 23:45:36 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-03-01 23:45:36 +0300
commitceae2d7422545ae493c6dbf0217d234fb28e2ebc (patch)
tree24d273988a2e9a84d916b915ae094bf5d78255e9 /test/functions
parent71b763b69278e43736e5821c4c5d35f51c643ee2 (diff)
remove most things
Diffstat (limited to 'test/functions')
-rwxr-xr-xtest/functions/colors.spec67
-rwxr-xr-xtest/functions/icons.spec479
-rwxr-xr-xtest/functions/utilities.spec109
3 files changed, 0 insertions, 655 deletions
diff --git a/test/functions/colors.spec b/test/functions/colors.spec
deleted file mode 100755
index 4ee71205..00000000
--- a/test/functions/colors.spec
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/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() {
- # Load Powerlevel9k
- source functions/colors.zsh
-}
-
-function testGetColorCodeWithAnsiForegroundColor() {
- assertEquals '002' "$(getColorCode 'green')"
-}
-
-function testGetColorCodeWithAnsiBackgroundColor() {
- assertEquals '002' "$(getColorCode 'bg-green')"
-}
-
-function testGetColorCodeWithNumericalColor() {
- assertEquals '002' "$(getColorCode '002')"
-}
-
-function testGetColorCodeWithNoneColor() {
- assertEquals 'none' "$(getColorCode 'NONE')"
-}
-
-function testIsSameColorComparesAnsiForegroundAndNumericalColorCorrectly() {
- assertTrue "isSameColor 'green' '002'"
-}
-
-function testIsSameColorComparesAnsiBackgroundAndNumericalColorCorrectly() {
- assertTrue "isSameColor 'bg-green' '002'"
-}
-
-function testIsSameColorComparesShortCodesCorrectly() {
- assertTrue "isSameColor '002' '2'"
-}
-
-function testIsSameColorDoesNotYieldNotEqualColorsTruthy() {
- assertFalse "isSameColor 'green' '003'"
-}
-
-function testIsSameColorHandlesNoneCorrectly() {
- assertTrue "isSameColor 'none' 'NOnE'"
-}
-
-function testIsSameColorCompareTwoNoneColorsCorrectly() {
- assertTrue "isSameColor 'none' 'none'"
-}
-
-function testIsSameColorComparesColorWithNoneCorrectly() {
- assertFalse "isSameColor 'green' 'none'"
-}
-
-function testBrightColorsWork() {
- # We had some code in the past that equalized bright colors
- # 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' '006'"
- assertEquals '006' "$(getColorCode 'cyan')"
- assertEquals '006' "$(getColor 'cyan')"
-}
-
-source shunit2/shunit2
diff --git a/test/functions/icons.spec b/test/functions/icons.spec
deleted file mode 100755
index 8083c095..00000000
--- a/test/functions/icons.spec
+++ /dev/null
@@ -1,479 +0,0 @@
-#!/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() {
- # Store old value for LC_CTYPE
- _OLD_LC_CTYPE="${LC_CTYPE}"
- # Reset actual LC_CTYPE
- unset LC_CTYPE
-}
-
-function tearDown() {
- # Restore LC_CTYPE
- LC_CTYPE="${_OLD_LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInDefaultMode() {
- local POWERLEVEL9K_MODE="default"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInAwesomePatchedMode() {
- local POWERLEVEL9K_MODE="awesome-patched"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInAwesomeFontconfigMode() {
- local POWERLEVEL9K_MODE="awesome-fontconfig"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInNerdfontFontconfigMode() {
- local POWERLEVEL9K_MODE="nerdfont-fontconfig"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInFlatMode() {
- local POWERLEVEL9K_MODE="flat"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-function testLcCtypeIsNotOverwrittenInCompatibleMode() {
- local POWERLEVEL9K_MODE="compatible"
- local LC_CTYPE="my-locale"
- # Load Powerlevel9k
- source functions/icons.zsh
-
- assertEquals 'my-locale' "${LC_CTYPE}"
-}
-
-# Go through all icons defined in default mode, and
-# check if all of them are defined in the other modes.
-function testAllIconsAreDefinedLikeInDefaultMode() {
- # Always compare against this mode
- local _P9K_TEST_MODE="default"
- local POWERLEVEL9K_MODE="${_P9K_TEST_MODE}"
- source functions/icons.zsh
- # _ICONS_UNDER_TEST is an array of just the keys of $icons.
- # We later check via (r) "subscript" flag that our key
- # is in the values of our flat array.
- typeset -ah _ICONS_UNDER_TEST
- _ICONS_UNDER_TEST=(${(k)icons[@]})
-
- # Switch to "awesome-patched" mode
- POWERLEVEL9K_MODE="awesome-patched"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- # Iterate over all keys found in the _ICONS_UNDER_TEST
- # array and compare it with the icons array of the
- # current POWERLEVEL9K_MODE.
- # Use parameter expansion, to directly check if the
- # key exists in the flat current array of keys. That
- # is quite complicated, but there seems no easy way
- # to check the mere existance of a key in an array.
- # The usual way would always return the value, so that
- # would do the wrong thing as we have some (on purpose)
- # empty values.
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-fontconfig" mode
- POWERLEVEL9K_MODE="awesome-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-fontconfig" mode
- POWERLEVEL9K_MODE="nerdfont-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-complete" mode
- POWERLEVEL9K_MODE="nerdfont-complete"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "flat" mode
- POWERLEVEL9K_MODE="flat"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "compatible" mode
- POWERLEVEL9K_MODE="compatible"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- unset current_icons
- unset _ICONS_UNDER_TEST
-}
-
-# Go through all icons defined in awesome-patched mode, and
-# check if all of them are defined in the other modes.
-function testAllIconsAreDefinedLikeInAwesomePatchedMode() {
- # Always compare against this mode
- local _P9K_TEST_MODE="awesome-patched"
- local POWERLEVEL9K_MODE="$_P9K_TEST_MODE"
- source functions/icons.zsh
- # _ICONS_UNDER_TEST is an array of just the keys of $icons.
- # We later check via (r) "subscript" flag that our key
- # is in the values of our flat array.
- typeset -ah _ICONS_UNDER_TEST
- _ICONS_UNDER_TEST=(${(k)icons[@]})
-
- # Switch to "default" mode
- POWERLEVEL9K_MODE="default"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- # Iterate over all keys found in the _ICONS_UNDER_TEST
- # array and compare it with the icons array of the
- # current POWERLEVEL9K_MODE.
- # Use parameter expansion, to directly check if the
- # key exists in the flat current array of keys. That
- # is quite complicated, but there seems no easy way
- # to check the mere existance of a key in an array.
- # The usual way would always return the value, so that
- # would do the wrong thing as we have some (on purpose)
- # empty values.
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-fontconfig" mode
- POWERLEVEL9K_MODE="awesome-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-fontconfig" mode
- POWERLEVEL9K_MODE="nerdfont-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-complete" mode
- POWERLEVEL9K_MODE="nerdfont-complete"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "flat" mode
- POWERLEVEL9K_MODE="flat"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "compatible" mode
- POWERLEVEL9K_MODE="compatible"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- unset current_icons
- unset _ICONS_UNDER_TEST
-}
-
-# Go through all icons defined in awesome-fontconfig mode, and
-# check if all of them are defined in the other modes.
-function testAllIconsAreDefinedLikeInAwesomeFontconfigMode() {
- # Always compare against this mode
- local _P9K_TEST_MODE="awesome-fontconfig"
- local POWERLEVEL9K_MODE="$_P9K_TEST_MODE"
- source functions/icons.zsh
- # _ICONS_UNDER_TEST is an array of just the keys of $icons.
- # We later check via (r) "subscript" flag that our key
- # is in the values of our flat array.
- typeset -ah _ICONS_UNDER_TEST
- _ICONS_UNDER_TEST=(${(k)icons[@]})
-
- # Switch to "default" mode
- POWERLEVEL9K_MODE="default"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- # Iterate over all keys found in the _ICONS_UNDER_TEST
- # array and compare it with the icons array of the
- # current POWERLEVEL9K_MODE.
- # Use parameter expansion, to directly check if the
- # key exists in the flat current array of keys. That
- # is quite complicated, but there seems no easy way
- # to check the mere existance of a key in an array.
- # The usual way would always return the value, so that
- # would do the wrong thing as we have some (on purpose)
- # empty values.
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-patched" mode
- POWERLEVEL9K_MODE="awesome-patched"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-fontconfig" mode
- POWERLEVEL9K_MODE="nerdfont-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-complete" mode
- POWERLEVEL9K_MODE="nerdfont-complete"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "flat" mode
- POWERLEVEL9K_MODE="flat"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "compatible" mode
- POWERLEVEL9K_MODE="compatible"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- unset current_icons
- unset _ICONS_UNDER_TEST
-}
-
-# Go through all icons defined in nerdfont-fontconfig mode, and
-# check if all of them are defined in the other modes.
-function testAllIconsAreDefinedLikeInNerdfontFontconfigMode() {
- # Always compare against this mode
- local _P9K_TEST_MODE="nerdfont-fontconfig"
- local POWERLEVEL9K_MODE="$_P9K_TEST_MODE"
- source functions/icons.zsh
- # _ICONS_UNDER_TEST is an array of just the keys of $icons.
- # We later check via (r) "subscript" flag that our key
- # is in the values of our flat array.
- typeset -ah _ICONS_UNDER_TEST
- _ICONS_UNDER_TEST=(${(k)icons[@]})
-
- # Switch to "default" mode
- POWERLEVEL9K_MODE="default"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- # Iterate over all keys found in the _ICONS_UNDER_TEST
- # array and compare it with the icons array of the
- # current POWERLEVEL9K_MODE.
- # Use parameter expansion, to directly check if the
- # key exists in the flat current array of keys. That
- # is quite complicated, but there seems no easy way
- # to check the mere existance of a key in an array.
- # The usual way would always return the value, so that
- # would do the wrong thing as we have some (on purpose)
- # empty values.
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-patched" mode
- POWERLEVEL9K_MODE="awesome-patched"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-fontconfig" mode
- POWERLEVEL9K_MODE="awesome-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-complete" mode
- POWERLEVEL9K_MODE="nerdfont-complete"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "flat" mode
- POWERLEVEL9K_MODE="flat"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "compatible" mode
- POWERLEVEL9K_MODE="compatible"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- unset current_icons
- unset _ICONS_UNDER_TEST
-}
-
-# Go through all icons defined in nerdfont-complete mode, and
-# check if all of them are defined in the other modes.
-function testAllIconsAreDefinedLikeInNerdfontCompleteMode() {
- # Always compare against this mode
- local _P9K_TEST_MODE="nerdfont-complete"
- local POWERLEVEL9K_MODE="$_P9K_TEST_MODE"
- source functions/icons.zsh
- # _ICONS_UNDER_TEST is an array of just the keys of $icons.
- # We later check via (r) "subscript" flag that our key
- # is in the values of our flat array.
- typeset -ah _ICONS_UNDER_TEST
- _ICONS_UNDER_TEST=(${(k)icons[@]})
-
- # Switch to "default" mode
- POWERLEVEL9K_MODE="default"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- # Iterate over all keys found in the _ICONS_UNDER_TEST
- # array and compare it with the icons array of the
- # current POWERLEVEL9K_MODE.
- # Use parameter expansion, to directly check if the
- # key exists in the flat current array of keys. That
- # is quite complicated, but there seems no easy way
- # to check the mere existance of a key in an array.
- # The usual way would always return the value, so that
- # would do the wrong thing as we have some (on purpose)
- # empty values.
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-patched" mode
- POWERLEVEL9K_MODE="awesome-patched"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "awesome-fontconfig" mode
- POWERLEVEL9K_MODE="awesome-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "nerdfont-fontconfig" mode
- POWERLEVEL9K_MODE="nerdfont-fontconfig"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "flat" mode
- POWERLEVEL9K_MODE="flat"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- # Switch to "compatible" mode
- POWERLEVEL9K_MODE="compatible"
- source functions/icons.zsh
- typeset -ah current_icons
- current_icons=(${(k)icons[@]})
- for key in ${_ICONS_UNDER_TEST}; do
- assertTrue "The key ${key} does exist in ${_P9K_TEST_MODE} mode, but not in ${POWERLEVEL9K_MODE}!" "(( ${+current_icons[(r)$key]} ))"
- done
-
- unset current_icons
- unset _ICONS_UNDER_TEST
-}
-
-source shunit2/shunit2 \ No newline at end of file
diff --git a/test/functions/utilities.spec b/test/functions/utilities.spec
deleted file mode 100755
index b727c1f6..00000000
--- a/test/functions/utilities.spec
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/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() {
- # Load Powerlevel9k
- source functions/icons.zsh
- source functions/utilities.zsh
-}
-
-function testDefinedFindsDefinedVariable() {
- my_var='X'
-
- assertTrue "defined 'my_var'"
- unset my_var
-}
-
-function testDefinedDoesNotFindUndefinedVariable() {
- assertFalse "defined 'my_var'"
-}
-
-function testSetDefaultSetsVariable() {
- set_default 'my_var' 'x'
-
- assertEquals 'x' "$my_var"
- unset my_var
-}
-
-function testPrintSizeHumanReadableWithBigNumber() {
- # Interesting: Currently we can't support numbers bigger than that.
- assertEquals '0.87E' "$(printSizeHumanReadable 1000000000000000000)"
-}
-
-function testPrintSizeHumanReadableWithExabytesAsBase() {
- assertEquals '9.77Z' "$(printSizeHumanReadable 10000 'E')"
-}
-
-function testGetRelevantItem() {
- typeset -a list
- list=(a b c)
- local callback='[[ "$item" == "b" ]] && echo "found"'
-
- local result=$(getRelevantItem "$list" "$callback")
- assertEquals 'found' "$result"
-
- unset list
-}
-
-function testGetRelevantItemDoesNotReturnNotFoundItems() {
- typeset -a list
- list=(a b c)
- local callback='[[ "$item" == "d" ]] && echo "found"'
-
- local result=$(getRelevantItem "$list" "$callback")
- assertEquals '' ''
-
- unset list
-}
-
-function testSegmentShouldBeJoinedIfDirectPredecessingSegmentIsJoined() {
- typeset -a segments
- segments=(a b_joined c_joined)
- # Look at the third segment
- local current_index=3
- local last_element_index=2
-
- local joined
- segmentShouldBeJoined $current_index $last_element_index "$segments" && joined=true || joined=false
- assertTrue "$joined"
-
- unset segments
-}
-
-function testSegmentShouldBeJoinedIfPredecessingSegmentIsJoinedTransitivley() {
- typeset -a segments
- segments=(a b_joined c_joined)
- # Look at the third segment
- local current_index=3
- # The last printed segment was the first one,
- # the second segmend was conditional.
- local last_element_index=1
-
- local joined
- segmentShouldBeJoined $current_index $last_element_index "$segments" && joined=true || joined=false
- assertTrue "$joined"
-
- unset segments
-}
-
-function testSegmentShouldNotBeJoinedIfPredecessingSegmentIsNotJoinedButConditional() {
- typeset -a segments
- segments=(a b_joined c d_joined)
- # Look at the fourth segment
- local current_index=4
- # The last printed segment was the first one,
- # the second segmend was conditional.
- local last_element_index=1
-
- local joined
- segmentShouldBeJoined $current_index $last_element_index "$segments" && joined=true || joined=false
- assertFalse "$joined"
-
- unset segments
-}
-
-source shunit2/shunit2