Permalink
Browse files

test: add msg validation to test-buffer-compare

PR-URL: #10807
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>
  • Loading branch information...
joshholl authored and jasnell committed Jan 14, 2017
1 parent e5eae97 commit 6af10907a2fd82ac9f1a159920815c69a76e17ee
Showing with 6 additions and 3 deletions.
  1. +6 −3 test/parallel/test-buffer-compare.js
@@ -28,8 +28,11 @@ assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(0)), 0);
assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(1)), -1); assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(1)), -1);
assert.strictEqual(Buffer.compare(Buffer.alloc(1), Buffer.alloc(0)), 1); assert.strictEqual(Buffer.compare(Buffer.alloc(1), Buffer.alloc(0)), 1);
assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc')); assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'),
/^TypeError: Arguments must be Buffers or Uint8Arrays$/);
assert.throws(() => Buffer.compare('abc', Buffer.alloc(1))); assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)),
/^TypeError: Arguments must be Buffers or Uint8Arrays$/);
assert.throws(() => Buffer.alloc(1).compare('abc')); assert.throws(() => Buffer.alloc(1).compare('abc'),
/^TypeError: Argument must be a Buffer or Uint8Array$/);

0 comments on commit 6af1090

Please sign in to comment.