From 6f011c7fab8d407ec0cd091e9cbeb03c276372ce Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Sat, 15 Nov 2014 06:18:19 +0100 Subject: 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). --- test/helper.sh | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.3