Skip to content

Commit 664d66a

Browse files
committed
Make string tests more consistent.
1 parent d9dc0e6 commit 664d66a

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

test/test.js

+28-27
Original file line numberDiff line numberDiff line change
@@ -2591,27 +2591,6 @@
25912591
}
25922592
});
25932593

2594-
QUnit.test('`_.' + methodName + '` should clone `index` and `input` array properties', function(assert) {
2595-
assert.expect(2);
2596-
2597-
var array = /x/.exec('vwxyz'),
2598-
actual = func(array);
2599-
2600-
assert.strictEqual(actual.index, 2);
2601-
assert.strictEqual(actual.input, 'vwxyz');
2602-
});
2603-
2604-
QUnit.test('`_.' + methodName + '` should clone `lastIndex` regexp property', function(assert) {
2605-
assert.expect(1);
2606-
2607-
// Avoid a regexp literal for older Opera and use `exec` for older Safari.
2608-
var regexp = RegExp('x', 'g');
2609-
regexp.exec('vwxyz');
2610-
2611-
var actual = func(regexp);
2612-
assert.strictEqual(actual.lastIndex, 3);
2613-
});
2614-
26152594
QUnit.test('`_.' + methodName + '` should clone buffers', function(assert) {
26162595
assert.expect(4);
26172596

@@ -2631,6 +2610,28 @@
26312610
}
26322611
});
26332612

2613+
QUnit.test('`_.' + methodName + '` should clone `index` and `input` array properties', function(assert) {
2614+
assert.expect(2);
2615+
2616+
var array = /c/.exec('abcde'),
2617+
actual = func(array);
2618+
2619+
assert.strictEqual(actual.index, 2);
2620+
assert.strictEqual(actual.input, 'abcde');
2621+
});
2622+
2623+
QUnit.test('`_.' + methodName + '` should clone `lastIndex` regexp property', function(assert) {
2624+
assert.expect(1);
2625+
2626+
// Avoid a regexp literal for older Opera and use `exec` for older Safari.
2627+
var regexp = RegExp('c', 'g');
2628+
2629+
regexp.exec('abcde');
2630+
2631+
var actual = func(regexp);
2632+
assert.strictEqual(actual.lastIndex, 3);
2633+
});
2634+
26342635
QUnit.test('`_.' + methodName + '` should clone prototype objects', function(assert) {
26352636
assert.expect(2);
26362637

@@ -8543,8 +8544,8 @@
85438544

85448545
assert.strictEqual(_.isEqual(array1, array2), true);
85458546

8546-
array1 = /x/.exec('vwxyz');
8547-
array2 = ['x'];
8547+
array1 = /c/.exec('abcde');
8548+
array2 = ['c'];
85488549

85498550
assert.strictEqual(_.isEqual(array1, array2), true);
85508551
});
@@ -14121,7 +14122,7 @@
1412114122
QUnit.test('should not convert strings to arrays when merging arrays of `source`', function(assert) {
1412214123
assert.expect(1);
1412314124

14124-
var object = { 'a': 'abcdef' },
14125+
var object = { 'a': 'abcde' },
1412514126
actual = _.merge(object, { 'a': ['x', 'y', 'z'] });
1412614127

1412714128
assert.deepEqual(actual, { 'a': ['x', 'y', 'z'] });
@@ -17542,9 +17543,9 @@
1754217543
QUnit.test('should replace the matched pattern', function(assert) {
1754317544
assert.expect(2);
1754417545

17545-
var string = 'abcdef';
17546-
assert.strictEqual(_.replace(string, 'def', '123'), 'abc123');
17547-
assert.strictEqual(_.replace(string, /[bdf]/g, '-'), 'a-c-e-');
17546+
var string = 'abcde';
17547+
assert.strictEqual(_.replace(string, 'de', '123'), 'abc123');
17548+
assert.strictEqual(_.replace(string, /[bd]/g, '-'), 'a-c-e');
1754817549
});
1754917550
}());
1755017551

0 commit comments

Comments
 (0)