Skip to content

Commit 62c5680

Browse files
joshhollMylesBorins
authored andcommitted
test: add msg validation to test-buffer-compare
PR-URL: #10807 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a786954 commit 62c5680

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/parallel/test-buffer-compare.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(0)), 0);
2323
assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(1)), -1);
2424
assert.strictEqual(Buffer.compare(Buffer.alloc(1), Buffer.alloc(0)), 1);
2525

26-
assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'));
26+
assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'),
27+
/^TypeError: Arguments must be Buffers$/);
2728

28-
assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)));
29+
assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)),
30+
/^TypeError: Arguments must be Buffers$/);
2931

30-
assert.throws(() => Buffer.alloc(1).compare('abc'));
32+
assert.throws(() => Buffer.alloc(1).compare('abc'),
33+
/^TypeError: Argument must be a Buffer$/);

0 commit comments

Comments
 (0)