0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/parallel/test-dgram-bind-default-address.js
Sakthipriyan Vairamani 69298d36cf test: formatting skip messages for TAP parsing
This patch makes the skip messages consistent so that the TAP plugin
in CI can parse the messages properly. The format will be

    1..0 # Skipped: [Actual reason why the test is skipped]

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>
2015-07-20 15:46:30 +05:30

31 lines
889 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var dgram = require('dgram');
// skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface
if (common.inFreeBSDJail) {
console.log('1..0 # Skipped: In a FreeBSD jail');
process.exit();
}
dgram.createSocket('udp4').bind(common.PORT + 0, common.mustCall(function() {
assert.equal(this.address().port, common.PORT + 0);
assert.equal(this.address().address, '0.0.0.0');
this.close();
}));
if (!common.hasIPv6) {
console.log('1..0 # Skipped: udp6 part of test, because no IPv6 support');
return;
}
dgram.createSocket('udp6').bind(common.PORT + 1, common.mustCall(function() {
assert.equal(this.address().port, common.PORT + 1);
var address = this.address().address;
if (address === '::ffff:0.0.0.0')
address = '::';
assert.equal(address, '::');
this.close();
}));