GeezerVison is showing github.com — Fix #a313f8 as _implodeString should not be cloned. · AuxControl/SRL-JavaScript@ff2e2d8
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/Builder.js -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -705,7 +705,6 @@ class Builder { |
705 | 705 | clone._lastMethodType = this._lastMethodType |
706 | 706 | clone._group = this._group |
707 | 707 | clone._captureNames = Array.from(this._captureNames) |
708 | | - clone._implodeString = this.implodeString |
709 | 708 |
|
710 | 709 | return clone |
711 | 710 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: test/builder-test.js +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -192,4 +192,18 @@ describe('Builder isMatching', () => { |
192 | 192 | assert.equal(matches_cached["first"], 'hello world') |
193 | 193 |
|
194 | 194 | }) |
| 195 | + it('Stores named captures with implodeString', () => { |
| 196 | + const query = "begin with literally 'hello '\ncapture (anything once or more) as first"; |
| 197 | + const regex_new = new SRL(query); |
| 198 | + const testcase = 'hello world'; |
| 199 | + |
| 200 | + let matches_new = regex_new.getMatch(testcase) |
| 201 | + assert.equal(matches_new["first"], 'world') |
| 202 | + |
| 203 | + const regex_cached = new SRL(query); |
| 204 | + |
| 205 | + let matches_cached = regex_cached.getMatch(testcase) |
| 206 | + assert.equal(matches_cached["first"], 'world') |
| 207 | + |
| 208 | + }) |
195 | 209 | }) |