aboutsummaryrefslogtreecommitdiff
path: root/test/segments/swap.spec
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-07-25 08:52:06 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-07-25 08:52:06 +0300
commit06de83cc0f2282b2217c6151277dfd6789593c2e (patch)
tree8e7d013b2f66f9431b732f64fe8c8c5c8a87e7c5 /test/segments/swap.spec
parent99f0eddd62806f99b8116e3f327689bc32529d5d (diff)
Prepare tests for performance optimizations
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})"
}