aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2017-03-18 22:08:56 +0300
committerDominik Ritter <dritter03@googlemail.com>2017-03-18 22:08:56 +0300
commit41d92371ae57f6e163e82ba036937e21b89c1e4d (patch)
treeaf682edb4946d9536c2dffb9ed70f73459751186 /test
parentd9374412e6841828c226b3529e0483d1a9aa65e9 (diff)
Add tests for setting the right locale in icons.zsh
Diffstat (limited to 'test')
-rwxr-xr-xtest/functions/icons.spec74
1 files changed, 74 insertions, 0 deletions
diff --git a/test/functions/icons.spec b/test/functions/icons.spec
new file mode 100755
index 00000000..0a6d5942
--- /dev/null
+++ b/test/functions/icons.spec
@@ -0,0 +1,74 @@
+#!/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
+
+ # Store old P9K mode
+ _OLD_P9K_MODE="${POWERLEVEL9K_MODE}"
+}
+
+function tearDown() {
+ # Restore LC_CTYPE
+ LC_CTYPE="${_OLD_LC_CTYPE}"
+
+ # Restore old P9K mode
+ POWERLEVEL9K_MODE="${_OLD_P9K_MODE}"
+}
+
+function testLcCtypeIsSetCorrectlyInDefaultMode() {
+ POWERLEVEL9K_MODE="default"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+function testLcCtypeIsSetCorrectlyInAwesomePatchedMode() {
+ POWERLEVEL9K_MODE="awesome-patched"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+function testLcCtypeIsSetCorrectlyInAwesomeFontconfigMode() {
+ POWERLEVEL9K_MODE="awesome-fontconfig"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+function testLcCtypeIsSetCorrectlyInNerdfontFontconfigMode() {
+ POWERLEVEL9K_MODE="nerdfont-fontconfig"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+function testLcCtypeIsSetCorrectlyInFlatMode() {
+ POWERLEVEL9K_MODE="flat"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+function testLcCtypeIsSetCorrectlyInCompatibleMode() {
+ POWERLEVEL9K_MODE="compatible"
+ # Load Powerlevel9k
+ source functions/icons.zsh
+
+ assertEquals 'en_US.UTF-8' "${LC_CTYPE}"
+}
+
+source shunit2/source/2.1/src/shunit2 \ No newline at end of file