unable get string length
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the napi_get_value_string_utf8 call in the addon method and tests/1-test.js; compare the shown invocation with the API's expected arguments. Run the hello test and confirm the echo path obtains the string length without reporting an error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am now testing for echo function,
for code
napi_value Method(napi_env env, napi_callback_info args)
{
// napi_value str;
napi_status status;
cout << "inside method!" << endl;
size_t argc = 0;
napi_value argv[1];
status = napi_get_cb_info(env, args, &argc, argv, nullptr, nullptr);
if (status != napi_ok)
{
napi_throw_error(env, NULL, "Error Get Parameters!");
return nullptr;
}
cout << "before argc!" << endl;
if (argc < 1)
{
cout << "" << endl;
return nullptr;
}
size_t strlen;
status = napi_get_value_string_utf8(env, argv[0], NULL, 0, &strlen);
if (status != napi_ok)
{
napi_throw_error(env, NULL, "Error Get String Length!");
return nullptr;
}
// status = napi_create_string_utf8(env, argv[0], NAPI_AUTO_LENGTH, res);
// if (status != napi_ok)
// {
// napi_throw_error(env, NULL, "Error Get String!");
// return nullptr;
// }
return nullptr;
}
and
status = napi_set_named_property(env, exports, "echo", fn);
and
echo('hello!')
,
I got:
inside method!
before argc!
before get string!
�"�d2
1) hello
0 passing (11ms)
1 failing
1) crypto
hello:
Error: Error Get String Length!
at Context.it (tests/1-test.js:4:24)
- Ngôn ngữ chính
- C++
- Star
- 2.6k
- Fork
- 602
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node-addon-examples
-
Create Valgrind run of tests Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
nodejs/node-addon-examples#585 · 1 reaction ·
-
Add .d.ts files in samples. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
nodejs/node-addon-examples#530 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
nodejs/node-addon-examples#445 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 32/100
nodejs/node-addon-examples#444 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
nodejs/node-addon-examples#381 ·
Tất cả issue của nodejs/node-addon-examples
Issue tương tự
-
Website Doc Typo Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
autowarefoundation/autoware_universe#13413 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
automated-analysis bug memory-safety
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100