Browse Source

fix protected/safe call sites in api test cases to omit errhandler_index

pull/2/head
Sami Vaarala 11 years ago
parent
commit
3d76854e39
  1. 2
      api-testcases/test-bug-push-buffer-maxsize.c
  2. 2
      api-testcases/test-bug-push-string-maxsize.c
  3. 4
      api-testcases/test-bug-set-top-wrap.c
  4. 4
      api-testcases/test-call-method.c
  5. 6
      api-testcases/test-call-prop.c
  6. 4
      api-testcases/test-call.c
  7. 2
      api-testcases/test-enum.c
  8. 2
      api-testcases/test-error.c
  9. 2
      api-testcases/test-fatal.c
  10. 4
      api-testcases/test-get-context.c
  11. 10
      api-testcases/test-get-set-top.c
  12. 2
      api-testcases/test-indirect-eval.c
  13. 8
      api-testcases/test-insert.c
  14. 2
      api-testcases/test-is-constructor-call.c
  15. 2
      api-testcases/test-new.c
  16. 2
      api-testcases/test-normalize-index.c
  17. 6
      api-testcases/test-pcall-method.c
  18. 8
      api-testcases/test-pcall-prop.c
  19. 4
      api-testcases/test-pcall.c
  20. 16
      api-testcases/test-poppers.c
  21. 4
      api-testcases/test-push-cfunc.c
  22. 2
      api-testcases/test-push-current-function.c
  23. 2
      api-testcases/test-push-current-thread.c
  24. 8
      api-testcases/test-remove.c
  25. 8
      api-testcases/test-replace.c
  26. 8
      api-testcases/test-require-boolean.c
  27. 8
      api-testcases/test-require-buffer.c
  28. 8
      api-testcases/test-require-context.c
  29. 8
      api-testcases/test-require-int.c
  30. 8
      api-testcases/test-require-lstring.c
  31. 8
      api-testcases/test-require-null.c
  32. 8
      api-testcases/test-require-number.c
  33. 8
      api-testcases/test-require-pointer.c
  34. 8
      api-testcases/test-require-string.c
  35. 8
      api-testcases/test-require-undefined.c
  36. 4
      api-testcases/test-safe-call.c
  37. 2
      api-testcases/test-safe-to-string.c
  38. 2
      api-testcases/test-throw.c
  39. 6
      api-testcases/test-to-boolean.c
  40. 6
      api-testcases/test-to-buffer.c
  41. 8
      api-testcases/test-to-defaultvalue.c
  42. 6
      api-testcases/test-to-int.c
  43. 14
      api-testcases/test-to-int32-uint32-uint16.c
  44. 6
      api-testcases/test-to-lstring.c
  45. 6
      api-testcases/test-to-null.c
  46. 6
      api-testcases/test-to-number.c
  47. 6
      api-testcases/test-to-pointer.c
  48. 6
      api-testcases/test-to-primitive.c
  49. 6
      api-testcases/test-to-string.c
  50. 6
      api-testcases/test-to-undefined.c
  51. 2
      api-testcases/test-validate-index.c

2
api-testcases/test-bug-push-buffer-maxsize.c

@ -81,7 +81,7 @@ int test_2b(duk_context *ctx) {
#define TEST(func) do { \
printf("*** %s\n", #func); \
rc = duk_safe_call(ctx, (func), 0, 1, DUK_INVALID_INDEX); \
rc = duk_safe_call(ctx, (func), 0, 1); \
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1)); \
duk_pop(ctx); \
} while (0)

2
api-testcases/test-bug-push-string-maxsize.c

@ -47,7 +47,7 @@ int test_1b(duk_context *ctx) {
}
#define TEST(func) do { \
printf("*** %s\n", #func); \
rc = duk_safe_call(ctx, (func), 0, 1, DUK_INVALID_INDEX); \
rc = duk_safe_call(ctx, (func), 0, 1); \
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1)); \
duk_pop(ctx); \
} while (0)

4
api-testcases/test-bug-set-top-wrap.c

@ -45,11 +45,11 @@ int test_2(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

4
api-testcases/test-call-method.c

@ -68,11 +68,11 @@ int test_2(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-call-prop.c

@ -97,15 +97,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

4
api-testcases/test-call.c

@ -66,11 +66,11 @@ int test_2(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-enum.c

@ -86,7 +86,7 @@ int test_1(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-error.c

@ -93,7 +93,7 @@ void dump_error(duk_context *ctx) {
/* use custom helper because of dump_error() */
#define TEST(func) do { \
printf("*** %s (duk_pcall)\n", #func); \
rc = duk_safe_call(ctx, (func), 0, 1, DUK_INVALID_INDEX); \
rc = duk_safe_call(ctx, (func), 0, 1); \
printf("==> rc=%d\n", rc); \
dump_error(ctx); \
duk_pop(ctx); \

2
api-testcases/test-fatal.c

@ -21,6 +21,6 @@ void test(duk_context *ctx) {
duk_context *new_ctx;
new_ctx = duk_create_heap(NULL, NULL, NULL, NULL, my_fatal_handler);
duk_safe_call(new_ctx, my_func, 0, 1, DUK_INVALID_INDEX);
duk_safe_call(new_ctx, my_func, 0, 1);
printf("duk_safe_call() returned, should not happen\n");
}

4
api-testcases/test-get-context.c

@ -53,11 +53,11 @@ int test_2(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);

10
api-testcases/test-get-set-top.c

@ -93,23 +93,23 @@ int test_5(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_5, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_5, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-indirect-eval.c

@ -20,7 +20,7 @@ void test(duk_context *ctx) {
duk_push_global_object(ctx);
duk_get_prop_string(ctx, -1, "testFunc");
rc = duk_pcall(ctx, 0, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 0);
printf("rc=%d\n", rc);
duk_pop_2(ctx);

8
api-testcases/test-insert.c

@ -66,19 +66,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-is-constructor-call.c

@ -28,7 +28,7 @@ int test_raw(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_raw, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_raw, 0, 1);
printf("rc=%d, ret=%s\n", rc, duk_to_string(ctx, -1));
}

2
api-testcases/test-new.c

@ -72,7 +72,7 @@ int test_raw(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_raw, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_raw, 0, 1);
printf("rc=%d, ret=%s\n", rc, duk_to_string(ctx, -1));
}

2
api-testcases/test-normalize-index.c

@ -65,7 +65,7 @@ void test(duk_context *ctx) {
for (idx = -5; idx <= 5; idx++) {
duk_push_int(ctx, idx);
duk_safe_call(ctx, req_norm_idx, 1, 1, DUK_INVALID_INDEX);
duk_safe_call(ctx, req_norm_idx, 1, 1);
printf("idx=%d -> duk_require_normalize_index -> %s\n", idx, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-pcall-method.c

@ -15,7 +15,7 @@ void test(duk_context *ctx) {
duk_push_int(ctx, 123); /* this */
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_method(ctx, 2, DUK_INVALID_INDEX);
rc = duk_pcall_method(ctx, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
@ -24,7 +24,7 @@ void test(duk_context *ctx) {
duk_push_int(ctx, 123); /* this */
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_method(ctx, 2, DUK_INVALID_INDEX);
rc = duk_pcall_method(ctx, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
@ -33,7 +33,7 @@ void test(duk_context *ctx) {
duk_push_int(ctx, 123); /* this */
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_method(ctx, 2, DUK_INVALID_INDEX);
rc = duk_pcall_method(ctx, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);

8
api-testcases/test-pcall-prop.c

@ -19,7 +19,7 @@ void test(duk_context *ctx) {
duk_push_string(ctx, "foo");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_prop(ctx, 1, 2, DUK_INVALID_INDEX);
rc = duk_pcall_prop(ctx, 1, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx); /* res */
duk_pop(ctx); /* obj */
@ -33,7 +33,7 @@ void test(duk_context *ctx) {
duk_push_string(ctx, "func_nonstrict");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_prop(ctx, 1, 2, DUK_INVALID_INDEX);
rc = duk_pcall_prop(ctx, 1, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx); /* res */
duk_pop(ctx); /* obj */
@ -47,7 +47,7 @@ void test(duk_context *ctx) {
duk_push_string(ctx, "func_strict");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_prop(ctx, 1, 2, DUK_INVALID_INDEX);
rc = duk_pcall_prop(ctx, 1, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx); /* res */
duk_pop(ctx); /* obj */
@ -57,7 +57,7 @@ void test(duk_context *ctx) {
duk_push_string(ctx, "foo");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall_prop(ctx, 1, 2, DUK_INVALID_INDEX);
rc = duk_pcall_prop(ctx, 1, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx); /* res */
duk_pop(ctx); /* obj */

4
api-testcases/test-pcall.c

@ -13,7 +13,7 @@ void test(duk_context *ctx) {
duk_eval_string(ctx, "(function (x,y) { return x+y; })");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall(ctx, 2, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
printf("top after pop: %d\n", duk_get_top(ctx));
@ -22,7 +22,7 @@ void test(duk_context *ctx) {
duk_eval_string(ctx, "(function (x,y) { throw new Error('my error'); })");
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
rc = duk_pcall(ctx, 2, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 2);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
printf("top after pop: %d\n", duk_get_top(ctx));

16
api-testcases/test-poppers.c

@ -122,35 +122,35 @@ void test(duk_context *ctx) {
int rc;
SETUP(2); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_a, 2, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_a, 2, 1);
printf("test_pop_1 -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(2); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_b, 2, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_b, 2, 1);
printf("test_pop_b -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(5); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_2a, 5, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_2a, 5, 1);
printf("test_pop_2a -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(5); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_2b, 5, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_2b, 5, 1);
printf("test_pop_2b -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(7); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_3a, 7, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_3a, 7, 1);
printf("test_pop_3a -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(7); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_3b, 7, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_3b, 7, 1);
printf("test_pop_3b -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(11); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_na, 11, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_na, 11, 1);
printf("test_pop_na -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
SETUP(11); PRINTTOP();
rc = duk_safe_call(ctx, test_pop_nb, 11, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_pop_nb, 11, 1);
printf("test_pop_nb -> top=%d, rc=%d, ret='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
PRINTTOP();

4
api-testcases/test-push-cfunc.c

@ -89,13 +89,13 @@ void test(duk_context *ctx) {
duk_set_top(ctx, 0);
duk_push_c_function(ctx, my_neg_ret, 0);
rc = duk_pcall(ctx, 0, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 0);
printf("top after calling my_neg_ret: %d, rc=%d, retval='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
duk_pop(ctx);
duk_set_top(ctx, 0);
duk_push_c_function(ctx, my_type_error_ret, 0);
rc = duk_pcall(ctx, 0, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 0);
printf("top after calling my_type_error_ret: %d, rc=%d, retval='%s'\n", duk_get_top(ctx), rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-push-current-function.c

@ -47,7 +47,7 @@ void test(duk_context *ctx) {
printf("basic case\n");
duk_push_c_function(ctx, my_func, 1 /*nargs*/);
duk_push_int(ctx, 123);
rc = duk_pcall(ctx, 1, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-push-current-thread.c

@ -48,7 +48,7 @@ void test(duk_context *ctx) {
printf("basic case\n");
duk_push_c_function(ctx, my_func, 1 /*nargs*/);
duk_push_int(ctx, 123);
rc = duk_pcall(ctx, 1, DUK_INVALID_INDEX);
rc = duk_pcall(ctx, 1);
printf("rc=%d, result='%s'\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-remove.c

@ -63,19 +63,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-replace.c

@ -59,19 +59,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-boolean.c

@ -38,19 +38,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-buffer.c

@ -74,19 +74,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-context.c

@ -66,7 +66,7 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
@ -74,15 +74,15 @@ void test(duk_context *ctx) {
* because it includes a tag number.
*/
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d -> %s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-int.c

@ -59,19 +59,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-lstring.c

@ -72,19 +72,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-null.c

@ -36,19 +36,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-number.c

@ -38,19 +38,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-pointer.c

@ -38,19 +38,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-string.c

@ -38,19 +38,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-require-undefined.c

@ -36,19 +36,19 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

4
api-testcases/test-safe-call.c

@ -35,7 +35,7 @@ void test(duk_context *ctx) {
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
duk_push_int(ctx, 12);
rc = duk_safe_call(ctx, test_1, 3 /*nargs*/, 2 /*nrets*/, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 3 /*nargs*/, 2 /*nrets*/);
if (rc == DUK_EXEC_SUCCESS) {
printf("1st return value: %s\n", duk_to_string(ctx, -2)); /* 21 */
printf("2nd return value: %s\n", duk_to_string(ctx, -1)); /* undefined */
@ -48,7 +48,7 @@ void test(duk_context *ctx) {
duk_push_int(ctx, 10);
duk_push_int(ctx, 11);
duk_push_int(ctx, 12);
rc = duk_safe_call(ctx, test_2, 3 /*nargs*/, 2 /*nrets*/, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 3 /*nargs*/, 2 /*nrets*/);
if (rc == DUK_EXEC_SUCCESS) {
printf("1st return value: %s\n", duk_to_string(ctx, -2)); /* 21 */
printf("2nd return value: %s\n", duk_to_string(ctx, -1)); /* undefined */

2
api-testcases/test-safe-to-string.c

@ -103,7 +103,7 @@ int test_1(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-throw.c

@ -11,7 +11,7 @@ int test_1(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d -> %s\n", rc, duk_get_string(ctx, -1));
}

6
api-testcases/test-to-boolean.c

@ -72,18 +72,18 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this test now results in an error string containing the
* exact index, which is platform dependent.
*/
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-buffer.c

@ -137,15 +137,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

8
api-testcases/test-to-defaultvalue.c

@ -65,22 +65,22 @@ int test_4(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this test now results in an error string containing the
* exact index, which is platform dependent.
*/
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_4, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-int.c

@ -121,15 +121,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

14
api-testcases/test-to-int32-uint32-uint16.c

@ -269,27 +269,27 @@ int test_3c(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2a, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2a, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2b, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2b, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2c, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2c, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3a, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3a, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3b, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3b, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3c, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3c, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);

6
api-testcases/test-to-lstring.c

@ -130,18 +130,18 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this testcase currently exposes the DUK_INVALID_INDEX
* constant in the error message and is thus not portable.
*/
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-null.c

@ -73,15 +73,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-number.c

@ -97,15 +97,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-pointer.c

@ -86,18 +86,18 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this test now results in an error string containing the
* exact index, which is platform dependent.
*/
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-primitive.c

@ -86,18 +86,18 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this test now results in an error string containing the
* exact index, which is platform dependent.
*/
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-string.c

@ -83,18 +83,18 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
/* FIXME: this testcase currently exposes the DUK_INVALID_INDEX
* constant in the error message and is thus not portable.
*/
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

6
api-testcases/test-to-undefined.c

@ -73,15 +73,15 @@ int test_3(duk_context *ctx) {
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_1, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_2, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
rc = duk_safe_call(ctx, test_3, 0, 1);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}

2
api-testcases/test-validate-index.c

@ -59,7 +59,7 @@ void test(duk_context *ctx) {
for (idx = -5; idx <= 5; idx++) {
duk_push_int(ctx, idx);
duk_safe_call(ctx, req_valid_idx, 1, 1, DUK_INVALID_INDEX);
duk_safe_call(ctx, req_valid_idx, 1, 1);
printf("idx=%d, duk_require_valid_index -> %s\n", idx, duk_to_string(ctx, -1));
duk_pop(ctx);
}

Loading…
Cancel
Save