(getBuffer)
| 25 | }; |
| 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(() => Buffer.alloc(len)); |
no test coverage detected
searching dependent graphs…