Add tests for __expand_path layout helper

This commit is contained in:
2014-05-26 11:34:53 +01:00
parent 47219d2d40
commit f977850ea9

View File

@@ -0,0 +1,27 @@
#! /usr/bin/env bash
source "../../test-helper.sh"
source "${root}/lib/layout-helpers.sh"
#
# __expand_path() tests.
#
# Setup.
realHOME="$HOME"
HOME="/home/test-user"
# When given a path containing "~", it expands "~" to "$HOME".
assert '__expand_path "~/Foo/Bar"' "${HOME}/Foo/Bar"
# When given a path without "~", it returns path as is.
assert '__expand_path "/path/to/file"' "/path/to/file"
# When given a path containing spaces, it returns path correctly.
assert '__expand_path "~/Path To/File"' "${HOME}/Path To/File"
# Tear down.
HOME="$realHOME"
unset realHOME
# End of tests.
assert_end "__expand_path()"