This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from atom/whole-word-replace-bug
Unable to replace text with special character when the search regex contains a word boundary
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const path = require('path') | ||
const TextBuffer = require('../src/text-buffer') | ||
|
||
describe('when a buffer is already open', () => { | ||
it('replaces foo( with bar( using /\bfoo\\(\b/gim', () => { | ||
const filePath = path.join(__dirname, 'fixtures', 'sample.js') | ||
const buffer = new TextBuffer() | ||
buffer.setPath(filePath) | ||
buffer.setText('foo(x)') | ||
buffer.replace(/\bfoo\(\b/gim, 'bar(') | ||
|
||
expect(buffer.getText()).toBe('bar(x)') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters