-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NLS: escape backslashes in query string
- Loading branch information
1 parent
798c73b
commit ae3cf95
Showing
3 changed files
with
30 additions
and
4 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
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
16 changes: 16 additions & 0 deletions
16
vscode/src/chat/chat-view/handlers/__tests__/SearchHandler.test.ts
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,16 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { escapeNLSQuery } from '../SearchHandler' | ||
|
||
describe('escapeNLSQuery', () => { | ||
it('escapes backslashes', () => { | ||
expect(escapeNLSQuery('path\\to\\file')).toBe('path\\\\to\\\\file') | ||
}) | ||
|
||
it('escapes double quotes', () => { | ||
expect(escapeNLSQuery(`say "hello"`)).toBe(`say \\"hello\\"`) | ||
}) | ||
|
||
it('escapes escaped quotes', () => { | ||
expect(escapeNLSQuery(`c:\\path\\"file"`)).toBe(`c:\\\\path\\\\\\"file\\"`) | ||
}) | ||
}) |