Skip to content

Commit 114a451

Browse files
committed
Use the allEscaped variable in the _.escape & _.unescape test
Fixes #2794.
1 parent 2a93247 commit 114a451

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/utility.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,13 @@
161161

162162
// handles multiple escape characters at once
163163
var joiner = ' other stuff ';
164-
var allEscaped = escapeCharacters.join(joiner);
165-
allEscaped += allEscaped;
166-
assert.ok(_.every(escapeCharacters, function(escapeChar) {
167-
return allEscaped.indexOf(escapeChar) !== -1;
168-
}), 'handles multiple characters');
169-
assert.ok(allEscaped.indexOf(joiner) >= 0, 'can escape multiple escape characters at the same time');
164+
var allUnescaped = escapeCharacters.join(joiner);
165+
allUnescaped += allUnescaped;
166+
var allEscaped = _.escape(allUnescaped);
167+
assert.ok(_.every(escapeCharacters), function(escapeChar) {
168+
return allEscaped.indexOf(escapeChar) === -1;
169+
}, 'replaces all occurrences');
170+
assert.strictEqual(_.unescape(allEscaped), allUnescaped, 'undos all replacements');
170171

171172
// test & -> &
172173
var str = 'some string & another string & yet another';

0 commit comments

Comments
 (0)