aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCatherine Tower <catherine@towernet.dev>2022-08-23 18:39:33 -0700
committerCatherine Tower <catherine@towernet.dev>2022-09-01 09:26:07 -0700
commit645c1f2aea0af84f607575d25720426cb3130db4 (patch)
tree4aa50e9dfb9c209a8e7049099b96237ef626fd81 /tests
parent72ef92113706645263c1118edd09044ca1f035c1 (diff)
downloadtigervnc-645c1f2aea0af84f607575d25720426cb3130db4.tar.gz
tigervnc-645c1f2aea0af84f607575d25720426cb3130db4.zip
Ignore whitespace around components of host-and-port specification
This is to make the code more tolerant of typos when entering a hostname
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/hostport.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/hostport.cxx b/tests/unit/hostport.cxx
index af60643a..6ca5df8f 100644
--- a/tests/unit/hostport.cxx
+++ b/tests/unit/hostport.cxx
@@ -80,5 +80,17 @@ int main(int argc, char** argv)
doTest("[2001:1234::20:1]:100", "2001:1234::20:1", 100);
doTest("[2001:1234::20:1]:5901", "2001:1234::20:1", 5901);
+ doTest(" 1.2.3.4 ", "1.2.3.4", 5900);
+ doTest(" 1.2.3.4:5901 ", "1.2.3.4", 5901);
+ doTest(" 1.2.3.4: 5901 ", "1.2.3.4", 5901);
+ doTest(" 1.2.3.4 :5901 ", "1.2.3.4", 5901);
+ doTest(" [1.2.3.4]:5902 ", "1.2.3.4", 5902);
+ doTest(" :5903 ", "localhost", 5903);
+ doTest(" ::4 ", "localhost", 4);
+ doTest(" [::1] ", "::1", 5900);
+ doTest(" 2001:1234::20:1 ", "2001:1234::20:1", 5900);
+ doTest(" [2001:1234::20:1] ", "2001:1234::20:1", 5900);
+ doTest(" [2001:1234::20:1]:5905 ", "2001:1234::20:1", 5905);
+
return 0;
}