summaryrefslogtreecommitdiff
path: root/test/segments/public_ip.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/public_ip.spec
parent99f0eddd62806f99b8116e3f327689bc32529d5d (diff)
Prepare tests for performance optimizations
Diffstat (limited to 'test/segments/public_ip.spec')
-rwxr-xr-xtest/segments/public_ip.spec29
1 files changed, 27 insertions, 2 deletions
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