Skip to content

test: convert most N-API tests from C++ to C

  • Prefix functions with static to make them local
  • Remove anonymous namespaces
  • nullptr -> NULL
  • .cc -> .c and update binding.gyp
  • static_cast<x>() -> (x)()
  • Replace new/delete with malloc()/free() (only in test_callback_scope)
  • Move lambda out and convert to local function (only in test_callback_scope)
  • Remove superfluous #include <vector> (only in test_callback_scope_recurse)

Some tests are best left as C++.

ls -l test/{node-api,js-native-api}/*/*.cc

for the rest.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading