diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@debian.org> | 2014-06-19 09:22:53 +0200 |
commit | 8a39ee361feb9bf46d728ff1ba4f07ca1d9610b1 (patch) | |
tree | 4449f2036cccf162e8417cc5841a35815b3e7ac5 /src/pkg/net/dnsconfig_unix_test.go | |
parent | c8bf49ef8a92e2337b69c14b9b88396efe498600 (diff) | |
download | golang-upstream/1.3.tar.gz |
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'src/pkg/net/dnsconfig_unix_test.go')
-rw-r--r-- | src/pkg/net/dnsconfig_unix_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pkg/net/dnsconfig_unix_test.go b/src/pkg/net/dnsconfig_unix_test.go new file mode 100644 index 000000000..37ed4931d --- /dev/null +++ b/src/pkg/net/dnsconfig_unix_test.go @@ -0,0 +1,46 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin dragonfly freebsd linux netbsd openbsd solaris + +package net + +import "testing" + +func TestDNSReadConfig(t *testing.T) { + dnsConfig, err := dnsReadConfig("testdata/resolv.conf") + if err != nil { + t.Fatal(err) + } + + if len(dnsConfig.servers) != 1 { + t.Errorf("len(dnsConfig.servers) = %d; want %d", len(dnsConfig.servers), 1) + } + if dnsConfig.servers[0] != "[192.168.1.1]" { + t.Errorf("dnsConfig.servers[0] = %s; want %s", dnsConfig.servers[0], "[192.168.1.1]") + } + + if len(dnsConfig.search) != 1 { + t.Errorf("len(dnsConfig.search) = %d; want %d", len(dnsConfig.search), 1) + } + if dnsConfig.search[0] != "Home" { + t.Errorf("dnsConfig.search[0] = %s; want %s", dnsConfig.search[0], "Home") + } + + if dnsConfig.ndots != 5 { + t.Errorf("dnsConfig.ndots = %d; want %d", dnsConfig.ndots, 5) + } + + if dnsConfig.timeout != 10 { + t.Errorf("dnsConfig.timeout = %d; want %d", dnsConfig.timeout, 10) + } + + if dnsConfig.attempts != 3 { + t.Errorf("dnsConfig.attempts = %d; want %d", dnsConfig.attempts, 3) + } + + if dnsConfig.rotate != true { + t.Errorf("dnsConfig.rotate = %t; want %t", dnsConfig.rotate, true) + } +} |