1
0
forked from Mirror/wren

Add API tests for returning null or numbers.

This commit is contained in:
Bob Nystrom
2015-05-24 10:04:24 -07:00
parent 6c135e9941
commit d66556b713
9 changed files with 66 additions and 7 deletions

View File

@ -6,6 +6,11 @@
#include "wren.h"
#include "return_bool/return_bool.h"
#include "return_double/return_double.h"
#include "return_null/return_null.h"
#define REGISTER_TEST(name) \
if (strcmp(testName, #name) == 0) return name##BindForeign(fullName)
// The name of the currently executing API test.
const char* testName;
@ -25,13 +30,13 @@ static WrenForeignMethodFn bindForeign(
strcat(fullName, ".");
strcat(fullName, signature);
if (strcmp(testName, "return_bool") == 0)
{
return returnBoolBindForeign(fullName);
}
REGISTER_TEST(return_bool);
REGISTER_TEST(return_double);
REGISTER_TEST(return_null);
fprintf(stderr,
"Unknown foreign method '%s' for test '%s'\n", fullName, testName);
exit(1);
return NULL;
}