From 62c56806fc7240036c7911513dd2f83b7d9d7d2e 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 Backport-PR-URL: https://github.com/nodejs/node/pull/13785 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 c0db39a6e3c8bc..6182d0967d4900 100644 --- a/test/parallel/test-buffer-compare.js +++ b/test/parallel/test-buffer-compare.js @@ -23,8 +23,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$/); -assert.throws(() => Buffer.compare('abc', Buffer.alloc(1))); +assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)), + /^TypeError: Arguments must be Buffers$/); -assert.throws(() => Buffer.alloc(1).compare('abc')); +assert.throws(() => Buffer.alloc(1).compare('abc'), + /^TypeError: Argument must be a Buffer$/);