Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
squash: fix test failures on 32bit platforms
  • Loading branch information
mhdawson committed Sep 28, 2017
commit ff719da924abde9b38372d7e0f8814695578ed99
9 changes: 8 additions & 1 deletion test/addons-napi/test_string/test_string.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <limits.h> // INT_MAX
#include <node_api.h>
#include "../common.h"

Expand Down Expand Up @@ -203,7 +204,13 @@ napi_value Utf8Length(napi_env env, napi_callback_info info) {

napi_value TestLargeUtf8(napi_env env, napi_callback_info info) {
napi_value output;
NAPI_CALL(env, napi_create_string_utf8(env, "", 4294967296 + 1, &output));
if (SIZE_MAX > INT_MAX) {
NAPI_CALL(env, napi_create_string_utf8(env, "", ((size_t)INT_MAX) + 1, &output));
} else {
// just throw the expected error as there is nothing to test
// in this case since we can't overflow
NAPI_CALL(env, napi_throw_error(env, NULL, "Invalid argument"));
}

return output;
}
Expand Down