OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package net | 5 package net |
6 | 6 |
7 import ( | 7 import ( |
8 "sort" | 8 "sort" |
9 "testing" | 9 "testing" |
10 ) | 10 ) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 hostsPath = p | 53 hostsPath = p |
54 } | 54 } |
55 | 55 |
56 func TestLookupHost(t *testing.T) { | 56 func TestLookupHost(t *testing.T) { |
57 // Can't depend on this to return anything in particular, | 57 // Can't depend on this to return anything in particular, |
58 // but if it does return something, make sure it doesn't | 58 // but if it does return something, make sure it doesn't |
59 // duplicate addresses (a common bug due to the way | 59 // duplicate addresses (a common bug due to the way |
60 // getaddrinfo works). | 60 // getaddrinfo works). |
61 addrs, _ := LookupHost("localhost") | 61 addrs, _ := LookupHost("localhost") |
62 » sort.SortStrings(addrs) | 62 » sort.Strings(addrs) |
63 for i := 0; i+1 < len(addrs); i++ { | 63 for i := 0; i+1 < len(addrs); i++ { |
64 if addrs[i] == addrs[i+1] { | 64 if addrs[i] == addrs[i+1] { |
65 t.Fatalf("LookupHost(\"localhost\") = %v, has duplicate
addresses", addrs) | 65 t.Fatalf("LookupHost(\"localhost\") = %v, has duplicate
addresses", addrs) |
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |