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().
This commit is contained in:
Bob Nystrom
2015-09-24 08:02:31 -07:00
parent a944ead5b4
commit f757c9efac
11 changed files with 159 additions and 14 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
#include "vm.h"
#include "wren.h"
#include "call.h"
#include "foreign_class.h"
#include "returns.h"
#include "value.h"
@@ -35,6 +36,7 @@ static WrenForeignMethodFn bindForeignMethod(
strcat(fullName, ".");
strcat(fullName, signature);
REGISTER_METHOD(call, call);
REGISTER_METHOD(foreign_class, foreignClass);
REGISTER_METHOD(returns, returns);
REGISTER_METHOD(value, value);
@@ -56,7 +58,6 @@ static WrenForeignClassMethods bindForeignClass(
return methods;
}
int main(int argc, const char* argv[])
{
if (argc != 2)
@@ -73,7 +74,7 @@ int main(int argc, const char* argv[])
strcat(testPath, testName);
strcat(testPath, ".wren");
setForeignCallbacks(bindForeignMethod, bindForeignClass);
setTestCallbacks(bindForeignMethod, bindForeignClass);
runFile(testPath);
return 0;
}