summaryrefslogtreecommitdiff
path: root/test/segments/swap.spec
diff options
context:
space:
mode:
Diffstat (limited to 'test/segments/swap.spec')
-rwxr-xr-xtest/segments/swap.spec12
1 files changed, 8 insertions, 4 deletions
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})"
}