0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/parallel/test-buffer-fakes.js
Zongmin Lei 256d86a155
test: remove require('buffer') from 4 test files
Remove superfluous import from:

* test/parallel/test-buffer-fakes.js
* test/parallel/test-buffer-includes.js
* test/parallel/test-buffer-indexof.js
* test/parallel/test-buffer-new.js

Refs: https://github.com/nodejs/node/issues/13836
PR-URL: https://github.com/nodejs/node/pull/13846
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-06-24 04:41:56 +03:00

55 lines
953 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
function FakeBuffer() { }
Object.setPrototypeOf(FakeBuffer, Buffer);
Object.setPrototypeOf(FakeBuffer.prototype, Buffer.prototype);
const fb = new FakeBuffer();
assert.throws(function() {
Buffer.from(fb);
}, TypeError);
assert.throws(function() {
+Buffer.prototype;
}, TypeError);
assert.throws(function() {
Buffer.compare(fb, Buffer.alloc(0));
}, TypeError);
assert.throws(function() {
fb.write('foo');
}, TypeError);
assert.throws(function() {
Buffer.concat([fb, fb]);
}, TypeError);
assert.throws(function() {
fb.toString();
}, TypeError);
assert.throws(function() {
fb.equals(Buffer.alloc(0));
}, TypeError);
assert.throws(function() {
fb.indexOf(5);
}, TypeError);
assert.throws(function() {
fb.readFloatLE(0);
}, TypeError);
assert.throws(function() {
fb.writeFloatLE(0);
}, TypeError);
assert.throws(function() {
fb.fill(0);
}, TypeError);