From: Feross Aboukhadijeh Date: Sat, 9 Jan 2016 14:44:23 +0000 (+0100) Subject: Include `is-buffer` test X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=953ab9de27fda2e9a043798f76e2b30b32190e5e;p=buffer.git Include `is-buffer` test For #93 --- diff --git a/package.json b/package.json index 04448cf..4a616bb 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "browserify": "^12.0.1", "concat-stream": "^1.4.7", "hyperquest": "^1.0.1", + "is-buffer": "^1.1.1", "is-nan": "^1.0.1", "split": "^1.0.0", "standard": "^5.0.0", diff --git a/test/is-buffer.js b/test/is-buffer.js new file mode 100644 index 0000000..3744b23 --- /dev/null +++ b/test/is-buffer.js @@ -0,0 +1,22 @@ +if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false +var B = require('../').Buffer +var isBuffer = require('is-buffer') +var test = require('tape') + +test('is-buffer tests', function (t) { + t.ok(isBuffer(new B(4)), 'new Buffer(4)') + + t.notOk(isBuffer(undefined), 'undefined') + t.notOk(isBuffer(null), 'null') + t.notOk(isBuffer(''), 'empty string') + t.notOk(isBuffer(true), 'true') + t.notOk(isBuffer(false), 'false') + t.notOk(isBuffer(0), '0') + t.notOk(isBuffer(1), '1') + t.notOk(isBuffer(1.0), '1.0') + t.notOk(isBuffer('string'), 'string') + t.notOk(isBuffer({}), '{}') + t.notOk(isBuffer(function foo () {}), 'function foo () {}') + + t.end() +})