aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorleongross <[email protected]>2024-09-17 07:12:57 -0700
committerGitHub <[email protected]>2024-09-17 16:12:57 +0200
commita9bf981d9219ad894c39d5dddce517708f7d0be5 (patch)
tree04982af928a5dd4d080416cd5581601291ee23c6 /testdata
parentd4729f92bde874dac83c07d96538dba90fd716d3 (diff)
downloadtinygo-a9bf981d9219ad894c39d5dddce517708f7d0be5.tar.gz
tinygo-a9bf981d9219ad894c39d5dddce517708f7d0be5.zip
Cgo add cbytes implementation (rebased version of #3318) (#4470)
cgo: added CBytes implementation
Diffstat (limited to 'testdata')
-rw-r--r--testdata/cgo/main.go2
-rw-r--r--testdata/cgo/out.txt2
2 files changed, 4 insertions, 0 deletions
diff --git a/testdata/cgo/main.go b/testdata/cgo/main.go
index ddd1992e2..00e0ba01d 100644
--- a/testdata/cgo/main.go
+++ b/testdata/cgo/main.go
@@ -165,6 +165,8 @@ func main() {
println("C.GoString(nil):", C.GoString(nil))
println("len(C.GoStringN(nil, 0)):", len(C.GoStringN(nil, 0)))
println("len(C.GoBytes(nil, 0)):", len(C.GoBytes(nil, 0)))
+ println("len(C.GoBytes(C.CBytes(nil),0)):", len(C.GoBytes(C.CBytes(nil), 0)))
+ println(`rountrip CBytes:`, C.GoString((*C.char)(C.CBytes([]byte("hello\000")))))
// libc: test whether C functions work at all.
buf1 := []byte("foobar\x00")
diff --git a/testdata/cgo/out.txt b/testdata/cgo/out.txt
index 4ea45d864..3088d4cb4 100644
--- a/testdata/cgo/out.txt
+++ b/testdata/cgo/out.txt
@@ -73,6 +73,8 @@ C.CStringN: 4 2 0 4 8
C.GoString(nil):
len(C.GoStringN(nil, 0)): 0
len(C.GoBytes(nil, 0)): 0
+len(C.GoBytes(C.CBytes(nil),0)): 0
+rountrip CBytes: hello
copied string: foobar
CGo sqrt(3): +1.732051e+000
C sqrt(3): +1.732051e+000