Ensure that Project.scan handles evil file fixtures correctly

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-07-19 11:15:08 -06:00
parent 12f765cc47
commit f0417e7287
2 changed files with 12 additions and 2 deletions

View File

@@ -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"

View File

@@ -0,0 +1 @@
I am evil because there's a UTF-8 character right here: ă