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.
6 // +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris
15 func TestCgoLookupIP(t *testing.T) {
16 defer dnsWaitGroup.Wait()
17 ctx := context.Background()
18 _, err, ok := cgoLookupIP(ctx, "ip", "localhost")
20 t.Errorf("cgoLookupIP must not be a placeholder")
27 func TestCgoLookupIPWithCancel(t *testing.T) {
28 defer dnsWaitGroup.Wait()
29 ctx, cancel := context.WithCancel(context.Background())
31 _, err, ok := cgoLookupIP(ctx, "ip", "localhost")
33 t.Errorf("cgoLookupIP must not be a placeholder")
40 func TestCgoLookupPort(t *testing.T) {
41 defer dnsWaitGroup.Wait()
42 ctx := context.Background()
43 _, err, ok := cgoLookupPort(ctx, "tcp", "smtp")
45 t.Errorf("cgoLookupPort must not be a placeholder")
52 func TestCgoLookupPortWithCancel(t *testing.T) {
53 defer dnsWaitGroup.Wait()
54 ctx, cancel := context.WithCancel(context.Background())
56 _, err, ok := cgoLookupPort(ctx, "tcp", "smtp")
58 t.Errorf("cgoLookupPort must not be a placeholder")
65 func TestCgoLookupPTR(t *testing.T) {
66 defer dnsWaitGroup.Wait()
67 ctx := context.Background()
68 _, err, ok := cgoLookupPTR(ctx, "127.0.0.1")
70 t.Errorf("cgoLookupPTR must not be a placeholder")
77 func TestCgoLookupPTRWithCancel(t *testing.T) {
78 defer dnsWaitGroup.Wait()
79 ctx, cancel := context.WithCancel(context.Background())
81 _, err, ok := cgoLookupPTR(ctx, "127.0.0.1")
83 t.Errorf("cgoLookupPTR must not be a placeholder")