diff options
author | Mike Burns <mike@mike-burns.com> | 2014-11-15 06:18:19 +0100 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2014-11-19 14:04:35 -0800 |
commit | 6f011c7fab8d407ec0cd091e9cbeb03c276372ce (patch) | |
tree | d42dba59c724d8ec13930296d0089fdac8563964 | |
parent | f8f204c0573e7b259eb2a070bf6017d0bcb95f52 (diff) |
Only use the host's name in the test
The test uses `$(hostname)`, which can produce the FQDN; however, the
code only uses the host name portion of that. Modify the test to do the
same by defining a `hostname` function that calls the hostname(1)
binary then pipes it through sed(1).
Use command instead of hardcoding the path.
OS X uses `$HOSTNAME` instead of the result of hostname(1). In the test
suite, use `$HOSTNAME` first, falling back to hostname(1).
-rw-r--r-- | test/helper.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/helper.sh b/test/helper.sh index 86ff989..d26749c 100644 --- a/test/helper.sh +++ b/test/helper.sh @@ -9,6 +9,14 @@ export RCM_LIB="$TESTDIR/../share" mkdir .dotfiles +hostname() { + if [ -n "$HOSTNAME" ]; then + echo "$HOSTNAME" + else + command hostname | sed -e 's/\..*//' + fi +} + assert() { local msg="$1"; shift |