mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 01:46:40 +00:00
Add tests for __expand_path layout helper
This commit is contained in:
27
test/lib/layout-helpers/__expand_path-test.sh
Executable file
27
test/lib/layout-helpers/__expand_path-test.sh
Executable 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()"
|
||||
Reference in New Issue
Block a user