test: improve buffer transcode
This test is for argument validation in transcode. PR-URL: https://github.com/nodejs/node/pull/10043 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
f5c2c8c7f4
commit
9f58e02908
@ -39,12 +39,18 @@ for (const test in tests) {
|
||||
}
|
||||
|
||||
assert.throws(
|
||||
() => buffer.transcode(Buffer.from('a'), 'b', 'utf8'),
|
||||
/Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
|
||||
() => buffer.transcode(null, 'utf8', 'ascii'),
|
||||
/^TypeError: "source" argument must be a Buffer$/
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => buffer.transcode(Buffer.from('a'), 'b', 'utf8'),
|
||||
/^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => buffer.transcode(Buffer.from('a'), 'uf8', 'b'),
|
||||
/Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
|
||||
/^Error: Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]$/
|
||||
);
|
||||
|
||||
assert.deepStrictEqual(
|
||||
|
Loading…
x
Reference in New Issue
Block a user