Skip to content

Commit 6af1090

Browse files
joshholljasnell
authored andcommitted
test: add msg validation to test-buffer-compare
PR-URL: #10807 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e5eae97 commit 6af1090

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/parallel/test-buffer-compare.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(0)), 0);
2828
assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(1)), -1);
2929
assert.strictEqual(Buffer.compare(Buffer.alloc(1), Buffer.alloc(0)), 1);
3030

31-
assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'));
31+
assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'),
32+
/^TypeError: Arguments must be Buffers or Uint8Arrays$/);
3233

33-
assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)));
34+
assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)),
35+
/^TypeError: Arguments must be Buffers or Uint8Arrays$/);
3436

35-
assert.throws(() => Buffer.alloc(1).compare('abc'));
37+
assert.throws(() => Buffer.alloc(1).compare('abc'),
38+
/^TypeError: Argument must be a Buffer or Uint8Array$/);

0 commit comments

Comments
 (0)