mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Optimize _.unescape.
This commit is contained in:
16
test/test.js
16
test/test.js
@@ -1942,12 +1942,16 @@
|
||||
var escaped = '&<>"'\/',
|
||||
unescaped = '&<>"\'\/';
|
||||
|
||||
test('should escape values', 1, function() {
|
||||
equal(_.escape(unescaped), escaped);
|
||||
});
|
||||
|
||||
test('should not escape the "/" character', 1, function() {
|
||||
equal(_.escape('/'), '/');
|
||||
});
|
||||
|
||||
test('should escape values', 1, function() {
|
||||
equal(_.escape(unescaped), escaped);
|
||||
test('should handle strings with nothing to escape', 1, function() {
|
||||
equal(_.escape('abc'), 'abc');
|
||||
});
|
||||
|
||||
test('should return an empty string when provided `null` or `undefined`', 2, function() {
|
||||
@@ -7788,6 +7792,14 @@
|
||||
equal(_.unescape(escaped), unescaped);
|
||||
});
|
||||
|
||||
test('should not unescape the "/" entity', 1, function() {
|
||||
equal(_.unescape('/'), '/');
|
||||
});
|
||||
|
||||
test('should handle strings with nothing to unescape', 1, function() {
|
||||
equal(_.unescape('abc'), 'abc');
|
||||
});
|
||||
|
||||
test('should unescape the same characters escaped by `_.escape`', 1, function() {
|
||||
equal(_.unescape(_.escape(unescaped)), unescaped);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user