summaryrefslogtreecommitdiff
path: root/test/simple/test-c-ares.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-04-07 15:37:08 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-04-07 15:37:08 -0700
commitf13e2f96e40ecdd6e76854508c3b0cad6bcd1a8d (patch)
tree3a50e45c9c58da5a9180a02810c05d878dad174c /test/simple/test-c-ares.js
parentf56ff0de9280a1371a319e368380043bd8c8fe6c (diff)
downloadnode-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.js28
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);
+});