Browse Source

Coerce with duk_safe_to_string() in runtests

Previously used duk_to_string() which may cause an uncaught error when a
thrown value cannot be string coerced (e.g. an error which participates
in a prototype loop causes an error when toString() is attempted).
v1.0-maintenance
Sami Vaarala 10 years ago
parent
commit
5043b54a27
  1. 4
      runtests/runtests.js

4
runtests/runtests.js

@ -312,7 +312,7 @@ var API_TEST_HEADER =
"\t\tprintf(\"*** %s (duk_safe_call)\\n\", #func); \\\n" + "\t\tprintf(\"*** %s (duk_safe_call)\\n\", #func); \\\n" +
"\t\tfflush(stdout); \\\n" + "\t\tfflush(stdout); \\\n" +
"\t\t_rc = duk_safe_call(ctx, (func), 0, 1); \\\n" + "\t\t_rc = duk_safe_call(ctx, (func), 0, 1); \\\n" +
"\t\tprintf(\"==> rc=%d, result='%s'\\n\", (int) _rc, duk_to_string(ctx, -1)); \\\n" + "\t\tprintf(\"==> rc=%d, result='%s'\\n\", (int) _rc, duk_safe_to_string(ctx, -1)); \\\n" +
"\t\tfflush(stdout); \\\n" + "\t\tfflush(stdout); \\\n" +
"\t\tduk_pop(ctx); \\\n" + "\t\tduk_pop(ctx); \\\n" +
"\t} while (0)\n" + "\t} while (0)\n" +
@ -323,7 +323,7 @@ var API_TEST_HEADER =
"\t\tfflush(stdout); \\\n" + "\t\tfflush(stdout); \\\n" +
"\t\tduk_push_c_function(ctx, (func), 0); \\\n" + "\t\tduk_push_c_function(ctx, (func), 0); \\\n" +
"\t\t_rc = duk_pcall(ctx, 0); \\\n" + "\t\t_rc = duk_pcall(ctx, 0); \\\n" +
"\t\tprintf(\"==> rc=%d, result='%s'\\n\", (int) _rc, duk_to_string(ctx, -1)); \\\n" + "\t\tprintf(\"==> rc=%d, result='%s'\\n\", (int) _rc, duk_safe_to_string(ctx, -1)); \\\n" +
"\t\tfflush(stdout); \\\n" + "\t\tfflush(stdout); \\\n" +
"\t\tduk_pop(ctx); \\\n" + "\t\tduk_pop(ctx); \\\n" +
"\t} while (0)\n" + "\t} while (0)\n" +

Loading…
Cancel
Save