mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Ensure that Project.scan handles evil file fixtures correctly
This commit is contained in:
@@ -139,10 +139,19 @@ describe "Project", ->
|
||||
it "works on evil filenames", ->
|
||||
project.setPath(require.resolve('fixtures/evil-files'))
|
||||
paths = []
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /evil/, ({path, match, range}) ->
|
||||
paths.push(path)
|
||||
matches.push(match)
|
||||
|
||||
runs ->
|
||||
expect(paths[0]).toMatch /file with spaces.txt$/
|
||||
expect(paths[1]).toMatch /goddam\nnewlines$/m
|
||||
expect(paths.length).toBe 5
|
||||
matches.forEach (match) -> expect(match).toEqual ['evil']
|
||||
expect(paths[0]).toMatch /a_file_with_utf8.txt$/
|
||||
expect(paths[1]).toMatch /file with spaces.txt$/
|
||||
expect(paths[2]).toMatch /goddam\nnewlines$/m
|
||||
expect(paths[3]).toMatch /quote".txt$/m
|
||||
expect(fs.base(paths[4])).toBe "utfa\u0306.md"
|
||||
|
||||
|
||||
|
||||
1
spec/fixtures/evil-files/a_file_with_utf8.txt
vendored
Normal file
1
spec/fixtures/evil-files/a_file_with_utf8.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
I am evil because there's a UTF-8 character right here: ă
|
||||
Reference in New Issue
Block a user