diff options
Diffstat (limited to 'test/parallel/test-tls-external-accessor.js')
-rw-r--r-- | test/parallel/test-tls-external-accessor.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/parallel/test-tls-external-accessor.js b/test/parallel/test-tls-external-accessor.js new file mode 100644 index 0000000000..33d371923a --- /dev/null +++ b/test/parallel/test-tls-external-accessor.js @@ -0,0 +1,22 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const tls = require('tls'); + +// Ensure accessing ._external doesn't hit an assert in the accessor method. +{ + const pctx = tls.createSecureContext().context; + const cctx = Object.create(pctx); + assert.throws(() => cctx._external, TypeError); + pctx._external; +} +{ + const pctx = tls.createSecurePair().credentials.context; + const cctx = Object.create(pctx); + assert.throws(() => cctx._external, TypeError); + pctx._external; +} |