mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 18:02:21 +00:00

This patch uses `return` statement to skip the test instead of using `process.exit` call. PR-URL: https://github.com/nodejs/io.js/pull/2109 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
26 lines
490 B
JavaScript
26 lines
490 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
console.log('1..0 # Skipped: missing crypto');
|
|
return;
|
|
}
|
|
var tls = require('tls');
|
|
|
|
var errors = 0;
|
|
|
|
var conn = tls.connect(common.PORT, function() {
|
|
assert(false); // callback should never be executed
|
|
});
|
|
conn.on('error', function() {
|
|
++errors;
|
|
assert.doesNotThrow(function() {
|
|
conn.destroy();
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(errors, 1);
|
|
});
|