swig/Examples/test-suite/go/char_binary_runme.go
Ian Lance Taylor 7aafe3d8b2 Fix all Go tests to build with "go build"
Tested against Go 1.6 through Go 1.13beta1, and gccgo.

Fixes #1607
2019-08-08 14:30:50 -07:00

25 lines
436 B
Go

package main
import . "swigtests/char_binary"
func main() {
t := NewTest()
if t.Strlen("hile") != 4 {
print(t.Strlen("hile"))
panic("bad multi-arg typemap")
}
if t.Strlen("hil\000") != 4 {
panic("bad multi-arg typemap")
}
// creating a raw char*
pc := New_pchar(5)
Pchar_setitem(pc, 0, 'h')
Pchar_setitem(pc, 1, 'o')
Pchar_setitem(pc, 2, 'l')
Pchar_setitem(pc, 3, 'a')
Pchar_setitem(pc, 4, 0)
Delete_pchar(pc)
}