summaryrefslogtreecommitdiff
path: root/libgo/go/net/hosts_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-05-20 00:18:15 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-05-20 00:18:15 +0000
commit9ff56c9570642711d5b7ab29920ecf5dbff14a27 (patch)
treec891bdec1e6f073f73fedeef23718bc3ac30d499 /libgo/go/net/hosts_test.go
parent37cb25ed7acdb844b218231130e54b8b7a0ff6e6 (diff)
downloadgcc-9ff56c9570642711d5b7ab29920ecf5dbff14a27.tar.gz
Update to current version of Go library.
From-SVN: r173931
Diffstat (limited to 'libgo/go/net/hosts_test.go')
-rw-r--r--libgo/go/net/hosts_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libgo/go/net/hosts_test.go b/libgo/go/net/hosts_test.go
index 470e35f7863..e5793eef2c7 100644
--- a/libgo/go/net/hosts_test.go
+++ b/libgo/go/net/hosts_test.go
@@ -5,6 +5,7 @@
package net
import (
+ "sort"
"testing"
)
@@ -51,3 +52,17 @@ func TestLookupStaticHost(t *testing.T) {
}
hostsPath = p
}
+
+func TestLookupHost(t *testing.T) {
+ // Can't depend on this to return anything in particular,
+ // but if it does return something, make sure it doesn't
+ // duplicate addresses (a common bug due to the way
+ // getaddrinfo works).
+ addrs, _ := LookupHost("localhost")
+ sort.SortStrings(addrs)
+ for i := 0; i+1 < len(addrs); i++ {
+ if addrs[i] == addrs[i+1] {
+ t.Fatalf("LookupHost(\"localhost\") = %v, has duplicate addresses", addrs)
+ }
+ }
+}