github.com/la5nta/wl2k-go@v0.11.8/transport/ax25/ax25_test.go (about) 1 package ax25 2 3 import ( 4 "net" 5 "testing" 6 ) 7 8 // Ref https://github.com/LA5NTA/wl2k-go/issues/10 9 func TestNilConn(t *testing.T) { 10 var conn net.Conn = (*Conn)(nil) 11 if conn != nil { 12 func() { 13 defer func() { 14 if r := recover(); r != nil { 15 t.Errorf("panic when calling method on non-nil interface: %v", r) 16 } 17 }() 18 19 if addr := conn.RemoteAddr(); addr != nil { 20 t.Errorf("RemoteAddr returned non-nil value for when called on nil-interface") 21 } 22 23 if addr := conn.LocalAddr(); addr != nil { 24 t.Errorf("LocalAddr returned non-nil value for when called on nil-interface") 25 } 26 }() 27 } 28 }