From 5b5bf2b5185fb34deb4e91f2b2b3c9040cc0723c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 29 Sep 2020 18:52:27 +0200 Subject: [PATCH] Test splitHostPort --- stream/srt/srt_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stream/srt/srt_test.go b/stream/srt/srt_test.go index a0320e6..403edf8 100644 --- a/stream/srt/srt_test.go +++ b/stream/srt/srt_test.go @@ -1 +1,17 @@ package srt + +import ( + "testing" +) + +func TestSplitHostPort(t *testing.T) { + host, port := splitHostPort("127.0.0.1:1234") + if host != "127.0.0.1" || port != 1234 { + t.Errorf("splitHostPort returned %v:%d != 127.0.0.1:1234", host, port) + } + + host, port = splitHostPort(":1234") + if host != "0.0.0.0" || port != 1234 { + t.Errorf("splitHostPort returned %v:%d != 0.0.0.0:1234", host, port) + } +}