[PATCH] Make hostname unit test pass if hostname is a single word.
by russell@russellbryant.net
This test failed on my host that has a hostname that is just a single
word, not "foo.tld" or "foo.bar.tld". Tweak the regex to allow it.
Signed-off-by: Russell Bryant <russell(a)russellbryant.net>
---
GNUmakefile | 2 +-
src/tests/mh_api_host.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 78585c8..e6087a2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -43,7 +43,7 @@ linux.build:
cd $@ && eval "`rpm --eval "%{cmake}" | grep -v -e "^%"`" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
@$(MAKE) --no-print-dir -C $@
@if [ -f $(a)/src/tests/CTestTestfile.cmake ]; then \
- cd $@/src/tests && ctest; \
+ cd $@/src/tests && ctest -V; \
fi
windows.build:
diff --git a/src/tests/mh_api_host.h b/src/tests/mh_api_host.h
index 710d42d..0911b30 100644
--- a/src/tests/mh_api_host.h
+++ b/src/tests/mh_api_host.h
@@ -57,7 +57,7 @@ class MhApiHostSuite : public CxxTest::TestSuite
{
infomsg << "Verify " << mh_host_get_hostname() << " format";
TS_TRACE(infomsg.str());
- TS_ASSERT((mh_test_is_match("^([0-9a-zA-Z]+([\\.]|$)){2,3}$",
+ TS_ASSERT((mh_test_is_match("^([0-9a-zA-Z]+([\\.]|$)){1,3}$",
mh_host_get_hostname())) >= 0);
infomsg.str("");
}
--
1.7.5.4