unable get string length
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- C++
- Stelle
- 2.6k
- Fork
- 602
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/node-addon-examples
-
Create Valgrind run of tests Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
nodejs/node-addon-examples#585 · 1 reazione ·
-
Add .d.ts files in samples. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
nodejs/node-addon-examples#530 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
nodejs/node-addon-examples#445 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 32/100
nodejs/node-addon-examples#444 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
nodejs/node-addon-examples#381 ·
Tutte le issue di nodejs/node-addon-examples
Issue simili
-
Website Doc Typo Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
automated-analysis bug memory-safety
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100