summaryrefslogtreecommitdiff
path: root/test/addons-napi/test_handle_scope/test.js
blob: eed99f81bd700b293340f4f5498fcdddcb1115be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';
const common = require('../../common');
const assert = require('assert');

// testing handle scope api calls
const testHandleScope = require(`./build/${common.buildType}/binding`);

testHandleScope.NewScope();

assert.ok(testHandleScope.NewScopeEscape() instanceof Object);

testHandleScope.NewScopeEscapeTwice();

assert.throws(
  () => {
    testHandleScope.NewScopeWithException(() => { throw new RangeError(); });
  },
  RangeError);