]> zoso.dev Git - buffer.git/commitdiff
Include `is-buffer` test
authorFeross Aboukhadijeh <feross@feross.org>
Sat, 9 Jan 2016 14:44:23 +0000 (15:44 +0100)
committerFeross Aboukhadijeh <feross@feross.org>
Sat, 9 Jan 2016 14:44:23 +0000 (15:44 +0100)
For #93

package.json
test/is-buffer.js [new file with mode: 0644]

index 04448cf745b53da1b90e3b812d215b4373bfffe7..4a616bb125c0d1339b5fe6eba765b9ec133a647e 100644 (file)
@@ -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 (file)
index 0000000..3744b23
--- /dev/null
@@ -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()
+})