swig/Examples/test-suite/go/char_binary_runme.go
Ian Lance Taylor 8a1c09e280 Fix Go tests to run in module mode
Stop using relative imports and add a go.mod file.

Tested against Go 1.6 through Go pre-1.13, and gccgo.
2019-04-24 21:43:38 -07:00

25 lines
426 B
Go

package main
import . "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)
}