github.com/roboticscm/goman@v0.0.0-20210203095141-87c07b4a0a55/src/net/cgo_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
     7  
     8  package net
     9  
    10  import "testing"
    11  
    12  func TestCgoLookupIP(t *testing.T) {
    13  	host := "localhost"
    14  	_, err, ok := cgoLookupIP(host)
    15  	if !ok {
    16  		t.Errorf("cgoLookupIP must not be a placeholder")
    17  	}
    18  	if err != nil {
    19  		t.Errorf("cgoLookupIP failed: %v", err)
    20  	}
    21  	if _, err := goLookupIP(host); err != nil {
    22  		t.Errorf("goLookupIP failed: %v", err)
    23  	}
    24  }