Files
wren/test/api/returns.wren
Bob Nystrom f757c9efac Better embedding API support (and tests!) for strings with null bytes.
- Test that a foreign method can return strings.
- Test that a foreign method can return a string with null bytes.
- Test wrenCall().
- Allow passing NULL for "v" to wrenCall().
- Allow "a" for passing an explicit length byte array to wrenCall().
2015-09-24 08:02:31 -07:00

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]