Revert r215321.
[official-gcc.git] / libgo / go / net / dnsconfig_unix_test.go
blob37ed4931dbe70ac6ceb6528a312ec09d6692069d
1 // Copyright 2013 The Go 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.
5 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
7 package net
9 import "testing"
11 func TestDNSReadConfig(t *testing.T) {
12 dnsConfig, err := dnsReadConfig("testdata/resolv.conf")
13 if err != nil {
14 t.Fatal(err)
17 if len(dnsConfig.servers) != 1 {
18 t.Errorf("len(dnsConfig.servers) = %d; want %d", len(dnsConfig.servers), 1)
20 if dnsConfig.servers[0] != "[192.168.1.1]" {
21 t.Errorf("dnsConfig.servers[0] = %s; want %s", dnsConfig.servers[0], "[192.168.1.1]")
24 if len(dnsConfig.search) != 1 {
25 t.Errorf("len(dnsConfig.search) = %d; want %d", len(dnsConfig.search), 1)
27 if dnsConfig.search[0] != "Home" {
28 t.Errorf("dnsConfig.search[0] = %s; want %s", dnsConfig.search[0], "Home")
31 if dnsConfig.ndots != 5 {
32 t.Errorf("dnsConfig.ndots = %d; want %d", dnsConfig.ndots, 5)
35 if dnsConfig.timeout != 10 {
36 t.Errorf("dnsConfig.timeout = %d; want %d", dnsConfig.timeout, 10)
39 if dnsConfig.attempts != 3 {
40 t.Errorf("dnsConfig.attempts = %d; want %d", dnsConfig.attempts, 3)
43 if dnsConfig.rotate != true {
44 t.Errorf("dnsConfig.rotate = %t; want %t", dnsConfig.rotate, true)