From ec8e2792354e0cb96dfa72deca8b1ff4ea40224b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 20 Sep 2016 07:49:40 -0700 Subject: [PATCH] Add `_.escape` and `_.unescape` tests for backticks. --- test/test.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/test/test.js b/test/test.js index 0c0b681c3..055a45811 100644 --- a/test/test.js +++ b/test/test.js @@ -5464,12 +5464,6 @@ assert.strictEqual(_.escape(unescaped), escaped); }); - QUnit.test('should not escape the "/" character', function(assert) { - assert.expect(1); - - assert.strictEqual(_.escape('/'), '/'); - }); - QUnit.test('should handle strings with nothing to escape', function(assert) { assert.expect(1); @@ -5481,6 +5475,14 @@ assert.strictEqual(_.escape(_.unescape(escaped)), escaped); }); + + lodashStable.each(['`', '/'], function(chr) { + QUnit.test('should not escape the "' + chr + '" character', function(assert) { + assert.expect(1); + + assert.strictEqual(_.escape(chr), chr); + }); + }); }()); /*--------------------------------------------------------------------------*/ @@ -24244,12 +24246,6 @@ assert.strictEqual(_.unescape(escaped), unescaped); }); - QUnit.test('should not unescape the "/" entity', function(assert) { - assert.expect(1); - - assert.strictEqual(_.unescape('/'), '/'); - }); - QUnit.test('should handle strings with nothing to unescape', function(assert) { assert.expect(1); @@ -24261,6 +24257,14 @@ assert.strictEqual(_.unescape(_.escape(unescaped)), unescaped); }); + + lodashStable.each(['`', '/'], function(entity) { + QUnit.test('should not unescape the "' + entity + '" entity', function(assert) { + assert.expect(1); + + assert.strictEqual(_.unescape(entity), entity); + }); + }); }()); /*--------------------------------------------------------------------------*/