A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/4c445a8c85 below:

skip in test-buffer-tostring-rangeerror on allocation failure · nodejs/node@4c445a8 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+19

-5

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+19

-5

lines changed Original file line number Diff line number Diff line change

@@ -23,8 +23,22 @@ const message = {

23 23

code: 'ERR_STRING_TOO_LONG',

24 24

name: 'Error',

25 25

};

26 -

assert.throws(() => Buffer(len).toString('utf8'), message);

27 -

assert.throws(() => SlowBuffer(len).toString('utf8'), message);

28 -

assert.throws(() => Buffer.alloc(len).toString('utf8'), message);

29 -

assert.throws(() => Buffer.allocUnsafe(len).toString('utf8'), message);

30 -

assert.throws(() => Buffer.allocUnsafeSlow(len).toString('utf8'), message);

26 + 27 +

function test(getBuffer) {

28 +

let buf;

29 +

try {

30 +

buf = getBuffer();

31 +

} catch (e) {

32 +

// If the buffer allocation fails, we skip the test.

33 +

if (e.code === 'ERR_MEMORY_ALLOCATION_FAILED' || /Array buffer allocation failed/.test(e.message)) {

34 +

return;

35 +

}

36 +

}

37 +

assert.throws(() => { buf.toString('utf8'); }, message);

38 +

}

39 + 40 +

test(() => Buffer(len));

41 +

test(() => SlowBuffer(len));

42 +

test(() => Buffer.alloc(len));

43 +

test(() => Buffer.allocUnsafe(len));

44 +

test(() => Buffer.allocUnsafeSlow(len));

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4