0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/addons-napi
Jason Ginchereau 468275ac79 n-api: remove napi_get_value_string_length()
This API doesn't serve much purpose, and is only likely to cause
confusion and bugs. The intention was that this would return the
number of characters in a string independent of encoding, but
that's not generally useful. In almost all cases, one of the
encoding-specific napi_get_value_string_* APIs is more correct.
(Pass a null buffer if only the encoded length is desired.)

Anyway the current implementation of napi_get_value_string_length()
is technically wrong: it returns the number of 2-byte code units of
the UTF-16 encoding, but there are actually some characters that
are encoded as two UTF-16 code units.

Note the JavaScript String.prototype.length property returns the
number of UTF-16 code units, which may be different from the number
of characters. So, getting the true character count is not common
with JavaScript, and is probably best left to specialized
internationalization libraries.

PR-URL: https://github.com/nodejs/node/pull/12496
Fixes: https://github.com/nodejs/abi-stable-node/issues/226
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 13:27:17 -04:00
..
1_hello_world n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
2_function_arguments n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
3_callbacks n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
4_object_factory n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
5_function_factory n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
6_object_wrap n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
7_factory_wrap n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
8_passing_wrapped n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_array n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_async n-api: implement async helper methods 2017-04-11 01:09:46 +02:00
test_buffer n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_constructor test: fix compiler warning in n-api test 2017-04-13 23:03:26 +02:00
test_conversions n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_error n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_exception n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_function n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_handle_scope test: improve test coverage for n-api 2017-04-12 15:26:08 -04:00
test_instanceof n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_napi_status n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_number n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_object n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_properties test: add second argument to assert.throws 2017-04-13 11:31:39 +02:00
test_string n-api: remove napi_get_value_string_length() 2017-04-20 13:27:17 -04:00
test_symbol n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
test_typedarray n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
.gitignore
common.h n-api: change napi_callback to return napi_value 2017-04-10 23:30:03 +02:00
testcfg.py