github.com/mattn/go@v0.0.0-20171011075504-07f7db3ea99f/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  	host := "localhost"
    17  	ctx := context.Background()
    18  	_, err, ok := cgoLookupIP(ctx, host)
    19  	if ok {
    20  		t.Errorf("cgoLookupIP must be a placeholder")
    21  	}
    22  	if err != nil {
    23  		t.Error(err)
    24  	}
    25  	if _, err := DefaultResolver.goLookupIP(ctx, host); err != nil {
    26  		t.Error(err)
    27  	}
    28  }