summaryrefslogtreecommitdiff
path: root/test/segments/load.spec
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/segments/load.spec
parent71b763b69278e43736e5821c4c5d35f51c643ee2 (diff)
remove most things
Diffstat (limited to 'test/segments/load.spec')
-rwxr-xr-xtest/segments/load.spec149
1 files changed, 0 insertions, 149 deletions
diff --git a/test/segments/load.spec b/test/segments/load.spec
deleted file mode 100755
index 5867b419..00000000
--- a/test/segments/load.spec
+++ /dev/null
@@ -1,149 +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() {
- export TERM="xterm-256color"
-
- P9K_HOME=$(pwd)
- ### Test specific
- # Create default folder and git init it.
- FOLDER=/tmp/powerlevel9k-test/load-test
- mkdir -p "${FOLDER}"
- cd $FOLDER
-}
-
-function tearDown() {
- # 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 testLoadSegmentWorksOnOsx() {
- sysctl() {
- if [[ "$*" == 'vm.loadavg' ]]; then
- echo "vm.loadavg: { 1,38 1,45 2,16 }";
- fi
-
- if [[ "$*" == '-n hw.logicalcpu' ]]; then
- echo "4";
- fi
- }
-
- local POWERLEVEL9K_LOAD_WHICH=1
-
- # Load Powerlevel9k
- source ${P9K_HOME}/powerlevel9k.zsh-theme
- local OS="OSX" # Fake OSX
-
- assertEquals "%K{002} %F{000}L %F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
-
- unfunction sysctl
-}
-
-function testLoadSegmentWorksOnBsd() {
- sysctl() {
- if [[ "$*" == 'vm.loadavg' ]]; then
- echo "vm.loadavg: { 1,38 1,45 2,16 }";
- fi
-
- if [[ "$*" == '-n hw.ncpu' ]]; then
- echo "4";
- fi
- }
-
- local POWERLEVEL9K_LOAD_WHICH=1
-
- # Load Powerlevel9k
- source ${P9K_HOME}/powerlevel9k.zsh-theme
- local OS="BSD" # Fake BSD
-
- assertEquals "%K{002} %F{000}L %F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
-
- unfunction sysctl
-}
-
-function testLoadSegmentWorksOnLinux() {
- # Prepare loadavg
- mkdir proc
- 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
-
- assertEquals "%K{002} %F{000}L %F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
-
- unalias nproc
-}
-
-# Test normal state. This test is not OS specific.
-# We test it as the Linux version, but that
-# does not matter here.
-function testLoadSegmentNormalState() {
- # Prepare loadavg
- mkdir proc
- 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
-
- assertEquals "%K{002} %F{000}L %F{000}1.00 " "$(prompt_load left 1 false ${FOLDER})"
-
- unalias nproc
-}
-
-# Test warning state. This test is not OS specific.
-# We test it as the Linux version, but that
-# does not matter here.
-function testLoadSegmentWarningState() {
- # Prepare loadavg
- mkdir proc
- 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
-
- assertEquals "%K{003} %F{000}L %F{000}2.01 " "$(prompt_load left 1 false ${FOLDER})"
-
- unalias nproc
-}
-
-# Test critical state. This test is not OS specific.
-# We test it as the Linux version, but that
-# does not matter here.
-function testLoadSegmentCriticalState() {
- # Prepare loadavg
- mkdir proc
- 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
-
- assertEquals "%K{001} %F{000}L %F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})"
-
- unalias nproc
-}
-
-source shunit2/shunit2 \ No newline at end of file