github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/misc/cgo/test/issue5548.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  package cgotest
     6  
     7  import "testing"
     8  
     9  /*
    10  extern int issue5548_in_c(void);
    11  */
    12  import "C"
    13  
    14  //export issue5548FromC
    15  func issue5548FromC(s string, i int) int {
    16  	if len(s) == 4 && s == "test" && i == 42 {
    17  		return 1
    18  	}
    19  	return 0
    20  }
    21  
    22  func test5548(t *testing.T) {
    23  	if C.issue5548_in_c() == 0 {
    24  		t.Fail()
    25  	}
    26  }