From a161184e754fcaadd3889096e30ac0e67421c4df Mon Sep 17 00:00:00 2001 From: dtucker Date: Sun, 6 Feb 2022 22:58:33 +0000 Subject: [PATCH] Add test for empty hostname with port. --- regress/usr.bin/ssh/unittests/misc/test_hpdelim.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/regress/usr.bin/ssh/unittests/misc/test_hpdelim.c b/regress/usr.bin/ssh/unittests/misc/test_hpdelim.c index ccd53d99c39..7f804456e79 100644 --- a/regress/usr.bin/ssh/unittests/misc/test_hpdelim.c +++ b/regress/usr.bin/ssh/unittests/misc/test_hpdelim.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test_hpdelim.c,v 1.1 2022/02/04 07:53:44 dtucker Exp $ */ +/* $OpenBSD: test_hpdelim.c,v 1.2 2022/02/06 22:58:33 dtucker Exp $ */ /* * Regress test for misc hpdelim() and co * @@ -35,6 +35,17 @@ test_hpdelim(void) DONE_STRING(); TEST_DONE(); + TEST_START("hpdelim :port"); + START_STRING(":1234"); + cp = hpdelim(&str); + ASSERT_STRING_EQ(cp, ""); + ASSERT_PTR_NE(str, NULL); + port = hpdelim(&str); + ASSERT_STRING_EQ(port, "1234"); + ASSERT_PTR_EQ(str, NULL); + DONE_STRING(); + TEST_DONE(); + TEST_START("hpdelim host:port"); START_STRING("host:1234"); cp = hpdelim(&str); -- 2.20.1