diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-04-07 15:37:08 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-04-07 15:37:08 -0700 |
commit | f13e2f96e40ecdd6e76854508c3b0cad6bcd1a8d (patch) | |
tree | 3a50e45c9c58da5a9180a02810c05d878dad174c /test/simple/test-c-ares.js | |
parent | f56ff0de9280a1371a319e368380043bd8c8fe6c (diff) | |
download | node-new-f13e2f96e40ecdd6e76854508c3b0cad6bcd1a8d.tar.gz |
Add a simple c-ares test, dns_cares.lookup() for easy resolv
Diffstat (limited to 'test/simple/test-c-ares.js')
-rw-r--r-- | test/simple/test-c-ares.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/simple/test-c-ares.js b/test/simple/test-c-ares.js new file mode 100644 index 0000000000..683babc474 --- /dev/null +++ b/test/simple/test-c-ares.js @@ -0,0 +1,28 @@ +require('../common'); + +var dns = require("dns_cares"); + + +// Try resolution without callback + +dns.getHostByName('localhost', function (error, result) { + p(result); + assert.deepEqual(['127.0.0.1'], result); +}); + +dns.getHostByName('127.0.0.1', function (error, result) { + p(result); + assert.deepEqual(['127.0.0.1'], result); +}); + +dns.lookup('127.0.0.1', function (error, result, ipVersion) { + assert.deepEqual('127.0.0.1', result); + assert.equal(4, ipVersion); +}); + +dns.lookup('ipv6.google.com', function (error, result, ipVersion) { + if (error) throw error; + p(arguments); + //assert.equal('string', typeof result); + assert.equal(6, ipVersion); +}); |