summaryrefslogtreecommitdiff
path: root/run-test262.c
diff options
context:
space:
mode:
Diffstat (limited to 'run-test262.c')
-rw-r--r--run-test262.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/run-test262.c b/run-test262.c
index 4397a1d..d1fa4f3 100644
--- a/run-test262.c
+++ b/run-test262.c
@@ -376,22 +376,29 @@ static JSValue js_print(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
int i;
- const char *str;
-
+ JSValueConst v;
+
if (outfile) {
for (i = 0; i < argc; i++) {
if (i != 0)
fputc(' ', outfile);
- str = JS_ToCString(ctx, argv[i]);
- if (!str)
- return JS_EXCEPTION;
- if (!strcmp(str, "Test262:AsyncTestComplete")) {
- async_done++;
- } else if (strstart(str, "Test262:AsyncTestFailure", NULL)) {
- async_done = 2; /* force an error */
+ v = argv[i];
+ if (JS_IsString(v)) {
+ const char *str;
+ size_t len;
+ str = JS_ToCStringLen(ctx, &len, v);
+ if (!str)
+ return JS_EXCEPTION;
+ if (!strcmp(str, "Test262:AsyncTestComplete")) {
+ async_done++;
+ } else if (strstart(str, "Test262:AsyncTestFailure", NULL)) {
+ async_done = 2; /* force an error */
+ }
+ fwrite(str, 1, len, outfile);
+ JS_FreeCString(ctx, str);
+ } else {
+ JS_PrintValue(ctx, outfile, v, NULL);
}
- fputs(str, outfile);
- JS_FreeCString(ctx, str);
}
fputc('\n', outfile);
}