github.com/s1s1ty/go@v0.0.0-20180207192209-104445e3140f/src/net/netgo_unix_test.go (about)

     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.
     4  
     5  // +build !cgo netgo
     6  // +build darwin dragonfly freebsd linux netbsd openbsd solaris
     7  
     8  package net
     9  
    10  import (
    11  	"context"
    12  	"testing"
    13  )
    14  
    15  func TestGoLookupIP(t *testing.T) {
    16  	defer dnsWaitGroup.Wait()
    17  	host := "localhost"
    18  	ctx := context.Background()
    19  	_, err, ok := cgoLookupIP(ctx, host)
    20  	if ok {
    21  		t.Errorf("cgoLookupIP must be a placeholder")
    22  	}
    23  	if err != nil {
    24  		t.Error(err)
    25  	}
    26  	if _, err := DefaultResolver.goLookupIP(ctx, host); err != nil {
    27  		t.Error(err)
    28  	}
    29  }