From 6af10907a2fd82ac9f1a159920815c69a76e17ee Mon Sep 17 00:00:00 2001 From: Josh Hollandsworth Date: Sat, 14 Jan 2017 09:14:38 -0600 Subject: [PATCH] test: add msg validation to test-buffer-compare PR-URL: https://github.com/nodejs/node/pull/10807 Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Santiago Gimeno Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-buffer-compare.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-buffer-compare.js b/test/parallel/test-buffer-compare.js index c9e50081edfc5f..b95e16914f7bd1 100644 --- a/test/parallel/test-buffer-compare.js +++ b/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(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$/);