go-hep.org/x/hep@v0.38.1/xrootd/port_test.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package xrootd 6 7 import "testing" 8 9 func TestParseAddr(t *testing.T) { 10 for _, tc := range []struct { 11 addr string 12 want string 13 }{ 14 {addr: "localhost:1094", want: "localhost:1094"}, 15 {addr: ":1094", want: ":1094"}, 16 {addr: "0.0.0.0:1094", want: "0.0.0.0:1094"}, 17 {addr: "0.0.0.0", want: "0.0.0.0:1094"}, 18 {addr: "192.168.0.1", want: "192.168.0.1:1094"}, 19 {addr: "ccxrootdgotest.in2p3.fr", want: "ccxrootdgotest.in2p3.fr:1094"}, 20 {addr: "ccxrootdgotest.in2p3.fr:8080", want: "ccxrootdgotest.in2p3.fr:8080"}, 21 } { 22 t.Run(tc.addr, func(t *testing.T) { 23 got := parseAddr(tc.addr) 24 if got != tc.want { 25 t.Fatalf("got=%q, want=%q", got, tc.want) 26 } 27 }) 28 } 29 }