diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2016-02-09 23:43:57 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2016-02-12 03:18:35 +0300 |
commit | ca6cbaa0b663b580c62d3187616af4d0aed79758 (patch) | |
tree | 23872aa40354ee00c268f9f90ffad5a1287892ff | |
parent | be0dce7ff6606bc0379ed209649a9fe74091d786 (diff) |
Add unit tests for printSizeHumanReadable
-rw-r--r-- | .travis.yml | 1 | ||||
-rwxr-xr-x | test/functions/utilities.spec | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index e2191a7c..33f99bbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,5 @@ install: script: - test/powerlevel9k.spec + - test/functions/utilities.spec diff --git a/test/functions/utilities.spec b/test/functions/utilities.spec new file mode 100755 index 00000000..12501348 --- /dev/null +++ b/test/functions/utilities.spec @@ -0,0 +1,22 @@ +#!/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 oneTimeSetUp() { + # Load Powerlevel9k + source functions/utilities.zsh +} + +function testPrintSizeHumanReadableWithBigNumber() { + # Interesting: Currently we can't support numbers bigger than that. + assertEquals '0.87E' "$(printSizeHumanReadable 1000000000000000000)" +} + +function testPrintSizeHumanReadableWithExabytesAsBase() { + assertEquals '9.77Z' "$(printSizeHumanReadable 10000 'E')" +} + +source shunit2/source/2.1/src/shunit2 |