diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-03 15:35:00 +0200 |
commit | de98e0b232509d5f40c135d540a70e415272ff85 (patch) | |
tree | a79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/errno/test.js | |
parent | e0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff) |
node_modules
Diffstat (limited to 'node_modules/errno/test.js')
-rwxr-xr-x | node_modules/errno/test.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/node_modules/errno/test.js b/node_modules/errno/test.js new file mode 100755 index 000000000..6b76a85ae --- /dev/null +++ b/node_modules/errno/test.js @@ -0,0 +1,31 @@ +#!/usr/bin/env node + +var test = require('tape') + , errno = require('./') + +test('sanity checks', function (t) { + t.ok(errno.all, 'errno.all not found') + t.ok(errno.errno, 'errno.errno not found') + t.ok(errno.code, 'errno.code not found') + + t.equal(errno.all.length, 59, 'found ' + errno.all.length + ', expected 59') + t.equal(errno.errno['-1'], errno.all[0], 'errno -1 not first element') + + t.equal(errno.code['UNKNOWN'], errno.all[0], 'code UNKNOWN not first element') + + t.equal(errno.errno[1], errno.all[2], 'errno 1 not third element') + + t.equal(errno.code['EOF'], errno.all[2], 'code EOF not third element') + t.end() +}) + +test('custom errors', function (t) { + var Cust = errno.create('FooNotBarError') + var cust = new Cust('foo is not bar') + + t.equal(cust.name, 'FooNotBarError', 'correct custom name') + t.equal(cust.type, 'FooNotBarError', 'correct custom type') + t.equal(cust.message, 'foo is not bar', 'correct custom message') + t.notOk(cust.cause, 'no cause') + t.end() +}) |