GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — buffer: prevent abort on bad proto · mscdex/io.js@40c334d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-buffer-fakes.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-buffer-fakes.js‎

Copy file name to clipboard
+56Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const Buffer = require('buffer').Buffer;
6+
const Bp = Buffer.prototype;
7+
8+
function FakeBuffer() { }
9+
FakeBuffer.__proto__ = Buffer;
10+
FakeBuffer.prototype.__proto__ = Buffer.prototype;
11+
12+
const fb = new FakeBuffer();
13+
14+
assert.throws(function() {
15+
new Buffer(fb);
16+
}, TypeError);
17+
18+
assert.throws(function() {
19+
+Buffer.prototype;
20+
}, TypeError);
21+
22+
assert.throws(function() {
23+
Buffer.compare(fb, new Buffer(0));
24+
}, TypeError);
25+
26+
assert.throws(function() {
27+
fb.write('foo');
28+
}, TypeError);
29+
30+
assert.throws(function() {
31+
Buffer.concat([fb, fb]);
32+
}, TypeError);
33+
34+
assert.throws(function() {
35+
fb.toString();
36+
}, TypeError);
37+
38+
assert.throws(function() {
39+
fb.equals(new Buffer(0));
40+
}, TypeError);
41+
42+
assert.throws(function() {
43+
fb.indexOf(5);
44+
}, TypeError);
45+
46+
assert.throws(function() {
47+
fb.readFloatLE(0);
48+
}, TypeError);
49+
50+
assert.throws(function() {
51+
fb.writeFloatLE(0);
52+
}, TypeError);
53+
54+
assert.throws(function() {
55+
fb.fill(0);
56+
}, TypeError);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.