Skip to content

Commit

Permalink
test: add segfault handler
Browse files Browse the repository at this point in the history
  • Loading branch information
morenol committed Sep 23, 2023
1 parent 786c2ce commit 29a50c7
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 6 deletions.
4 changes: 3 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ clean:
make -C cleanup clean
make -C logging clean

install:
npm install

test: test-function test-cb test-async-cb test-promise test-json test-class-simple \
test: install test-function test-cb test-async-cb test-promise test-json test-class-simple \
test-class-wrapper test-class-async test-stream test-buffer test-array test-bigint test-logging\
test-cleanup

Expand Down
12 changes: 7 additions & 5 deletions examples/class-async/test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
const assert = require('assert');
const SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler('crash.log');

let addon = require('./dist');

let obj = new addon.MyObject(10);


obj.plusTwo(10).then( (val) => {
console.log("plus two is ",val);
obj.plusTwo(10).then((val) => {
console.log("plus two is ", val);
});

obj.multiply2(-1).then( (obj3) => {
console.log("multiply two ",obj3.value);
obj.multiply2(-1).then((obj3) => {
console.log("multiply two ", obj3.value);
});

obj.sleep((msg) => {
assert.equal(msg,"hello world");;
assert.equal(msg, "hello world");;
});
44 changes: 44 additions & 0 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "node-bindgen-examples",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"segfault-handler": "^1.3.0"
}
}

0 comments on commit 29a50c7

Please sign in to comment.