Skip to content

Commit 1f11deb

Browse files
Johnny ReadingFishrock123
authored andcommitted
test: improve buffer transcode
This test is for argument validation in transcode. PR-URL: #10043 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 3e8df73 commit 1f11deb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎test/parallel/test-icu-transcode.js‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ for (const test in tests){
3838
utf8_to_ucs2.toString('ucs2'));
3939
}
4040

41+
assert.throws(
42+
()=>buffer.transcode(null,'utf8','ascii'),
43+
/^TypeError:"source"argumentmustbeaBuffer$/
44+
);
45+
4146
assert.throws(
4247
()=>buffer.transcode(Buffer.from('a'),'b','utf8'),
43-
/UnabletotranscodeBuffer\[U_ILLEGAL_ARGUMENT_ERROR\]/
48+
/^Error:UnabletotranscodeBuffer\[U_ILLEGAL_ARGUMENT_ERROR\]/
4449
);
50+
4551
assert.throws(
4652
()=>buffer.transcode(Buffer.from('a'),'uf8','b'),
47-
/UnabletotranscodeBuffer\[U_ILLEGAL_ARGUMENT_ERROR\]/
53+
/^Error:UnabletotranscodeBuffer\[U_ILLEGAL_ARGUMENT_ERROR\]$/
4854
);
4955

5056
assert.deepStrictEqual(

0 commit comments

Comments
(0)