Add a new 'a' format specifier to wrenCall that accepts an explicit byte array and length, enabling callers to pass strings containing null bytes without truncation. Also allow passing NULL for 'v' specifier arguments to produce a Wren NULL value. Rename setForeignCallbacks to setTestCallbacks for clarity. Extend the test suite with a new call.c test file that exercises all argument types including 'a' and 'v' with NULL, and add returnString/returnBytes foreign methods to verify wrenReturnString handles both null-terminated and explicit-length strings correctly.
24 lines
591 B
Plaintext
24 lines
591 B
Plaintext
class Api {
|
|
foreign static implicitNull
|
|
|
|
foreign static returnInt
|
|
foreign static returnFloat
|
|
|
|
foreign static returnTrue
|
|
foreign static returnFalse
|
|
|
|
foreign static returnString
|
|
foreign static returnBytes
|
|
}
|
|
|
|
System.print(Api.implicitNull == null) // expect: true
|
|
|
|
System.print(Api.returnInt) // expect: 123456
|
|
System.print(Api.returnFloat) // expect: 123.456
|
|
|
|
System.print(Api.returnTrue) // expect: true
|
|
System.print(Api.returnFalse) // expect: false
|
|
|
|
System.print(Api.returnString) // expect: a string
|
|
System.print(Api.returnBytes.bytes.toList) // expect: [97, 0, 98, 0, 99]
|