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 — test: deflake test-buffer-large-size · nodejs/node@660d238

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/pummel
    • test-buffer-large-size-buffer-alloc-unsafe-slow.js
    • test-buffer-large-size-buffer-alloc-unsafe.js
    • test-buffer-large-size-buffer-alloc.js
    • test-buffer-large-size-buffer-write.js
    • test-buffer-large-size-slowbuffer.js
    • test-buffer-large-size.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/pummel/test-buffer-large-size-buffer-alloc-unsafe-slow.js‎

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('node:assert');
8+
const size = 2 ** 31;
9+
10+
// Test Buffer.allocUnsafe with size larger than integer range
11+
try {
12+
assert.throws(() => Buffer.allocUnsafeSlow(size).toString('utf8'), { code: 'ERR_STRING_TOO_LONG' });
13+
} catch (e) {
14+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
15+
throw e;
16+
}
17+
common.skip('insufficient space for Buffer.allocUnsafeSlow');
18+
}
Collapse file

‎test/pummel/test-buffer-large-size-buffer-alloc-unsafe.js‎

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('node:assert');
8+
const size = 2 ** 31;
9+
10+
try {
11+
// Test Buffer.allocUnsafe with size larger than integer range
12+
assert.throws(() => Buffer.allocUnsafe(size).toString('utf8'), { code: 'ERR_STRING_TOO_LONG' });
13+
} catch (e) {
14+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
15+
throw e;
16+
}
17+
common.skip('insufficient space for Buffer.allocUnsafe');
18+
}
Collapse file

‎test/pummel/test-buffer-large-size-buffer-alloc.js‎

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('node:assert');
8+
const size = 2 ** 31;
9+
10+
// Test Buffer.alloc with size larger than integer range
11+
try {
12+
assert.throws(() => Buffer.alloc(size).toString('utf8'), { code: 'ERR_STRING_TOO_LONG' });
13+
} catch (e) {
14+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
15+
throw e;
16+
}
17+
common.skip('insufficient space for Buffer.alloc');
18+
}
Collapse file

‎test/pummel/test-buffer-large-size-buffer-write.js‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('node:assert');
8+
const kStringMaxLength = require('buffer').constants.MAX_STRING_LENGTH;
9+
10+
const size = 2 ** 31;
11+
12+
// Test Buffer.write with size larger than integer range
13+
try {
14+
const buf = Buffer.alloc(size);
15+
assert.strictEqual(buf.write('a', 2, kStringMaxLength), 1);
16+
assert.strictEqual(buf.write('a', 2, size), 1);
17+
} catch (e) {
18+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
19+
throw e;
20+
}
21+
common.skip('insufficient space for Buffer.alloc');
22+
}
Collapse file

‎test/pummel/test-buffer-large-size-slowbuffer.js‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('node:assert');
8+
const {
9+
SlowBuffer,
10+
} = require('node:buffer');
11+
12+
const size = 2 ** 31;
13+
14+
// Test SlowBuffer with size larger than integer range
15+
try {
16+
assert.throws(() => SlowBuffer(size).toString('utf8'), { code: 'ERR_STRING_TOO_LONG' });
17+
} catch (e) {
18+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
19+
throw e;
20+
}
21+
common.skip('insufficient space for SlowBuffer');
22+
}
Collapse file

‎test/pummel/test-buffer-large-size.js‎

Copy file name to clipboardExpand all lines: test/pummel/test-buffer-large-size.js
-51Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.