new tests to fix #2 by not breaking when initial tests fail in our recheck function
This commit is contained in:
@@ -267,6 +267,18 @@ describe('wildstring - angular', function() {
|
|||||||
// Then: we should see that they match
|
// Then: we should see that they match
|
||||||
assert.equal(result, true);
|
assert.equal(result, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to see the same character as a wildcard', function() {
|
||||||
|
// Given: a string with the same character multiple times, and a pattern with a wildcard and some of the same character
|
||||||
|
var pattern = '*zz',
|
||||||
|
string = 'zzz';
|
||||||
|
|
||||||
|
// When: we call wildstring.match
|
||||||
|
var result = wildstring.match(pattern, string);
|
||||||
|
|
||||||
|
// Then: we should see that they match
|
||||||
|
assert.equal(result, true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#replace', function() {
|
describe('#replace', function() {
|
||||||
|
|||||||
12
test/test.js
12
test/test.js
@@ -261,6 +261,18 @@ describe('wildstring - node', function() {
|
|||||||
// Then: we should see that they match
|
// Then: we should see that they match
|
||||||
assert.equal(result, true);
|
assert.equal(result, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to see the same character as a wildcard', function() {
|
||||||
|
// Given: a string with the same character multiple times, and a pattern with a wildcard and some of the same character
|
||||||
|
var pattern = '*zz',
|
||||||
|
string = 'zzz';
|
||||||
|
|
||||||
|
// When: we call wildstring.match
|
||||||
|
var result = wildstring.match(pattern, string);
|
||||||
|
|
||||||
|
// Then: we should see that they match
|
||||||
|
assert.equal(result, true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#replace', function() {
|
describe('#replace', function() {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ var wildstring = {
|
|||||||
rollbackStrings.push({ string: testString, index: patternIndex });
|
rollbackStrings.push({ string: testString, index: patternIndex });
|
||||||
if (testString.indexOf(patternSubstrings[patternIndex]) === -1) {
|
if (testString.indexOf(patternSubstrings[patternIndex]) === -1) {
|
||||||
rollbackStrings.pop();
|
rollbackStrings.pop();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentString = currentString.substr(
|
currentString = currentString.substr(
|
||||||
|
|||||||
Reference in New Issue
Block a user