Skip to content

Conversation

@gabrielschulhof
Copy link
Contributor

  • 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

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Aug 3, 2020
@gabrielschulhof gabrielschulhof added the node-api Issues and PRs related to the Node-API. label Aug 3, 2020
* 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++.

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

for the rest.

Signed-off-by: Gabriel Schulhof <[email protected]>
@nodejs-github-bot
Copy link
Collaborator

gabrielschulhof pushed a commit that referenced this pull request Aug 5, 2020
* 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++.

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

for those remaining as C++ tests.

Signed-off-by: Gabriel Schulhof <[email protected]>
PR-URL: #34615
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
@gabrielschulhof
Copy link
Contributor Author

Landed in 7343272.

@gabrielschulhof gabrielschulhof deleted the n-api-make-tests-C branch August 5, 2020 21:24
codebytere pushed a commit that referenced this pull request Aug 6, 2020
* 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++.

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

for those remaining as C++ tests.

Signed-off-by: Gabriel Schulhof <[email protected]>
PR-URL: #34615
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
@codebytere codebytere mentioned this pull request Aug 10, 2020
codebytere pushed a commit that referenced this pull request Aug 11, 2020
* 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++.

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

for those remaining as C++ tests.

Signed-off-by: Gabriel Schulhof <[email protected]>
PR-URL: #34615
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
* 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++.

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

for those remaining as C++ tests.

Signed-off-by: Gabriel Schulhof <[email protected]>
PR-URL: #34615
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
@addaleax
Copy link
Member

@gabrielschulhof Can you backport this to v12.x? It applies cleanly but doesn’t compile successfully on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants