mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Rename path variables to prevent collisions
This commit is contained in:
@@ -40,8 +40,8 @@ describe "Project", ->
|
||||
newEditSessionHandler = jasmine.createSpy('newEditSessionHandler')
|
||||
project.on 'edit-session-created', newEditSessionHandler
|
||||
|
||||
fooOpener = (path, options) -> { foo: path, options } if path?.match(/\.foo/)
|
||||
barOpener = (path) -> { bar: path } if path?.match(/^bar:\/\//)
|
||||
fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/)
|
||||
barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//)
|
||||
Project.registerOpener(fooOpener)
|
||||
Project.registerOpener(barOpener)
|
||||
|
||||
@@ -212,8 +212,7 @@ describe "Project", ->
|
||||
it "calls the callback with all regex matches in all files in the project", ->
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /(a)+/, ({path, match, range}) ->
|
||||
matches.push({path, match, range})
|
||||
project.scan /(a)+/, (match) -> matches.push(match)
|
||||
|
||||
runs ->
|
||||
expect(matches[0]).toEqual
|
||||
@@ -229,8 +228,7 @@ describe "Project", ->
|
||||
it "works with with escaped literals (like $ and ^)", ->
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /\$\w+/, ({path, match, range}) ->
|
||||
matches.push({path, match, range})
|
||||
project.scan /\$\w+/, (match) -> matches.push(match)
|
||||
|
||||
runs ->
|
||||
expect(matches.length).toBe 1
|
||||
@@ -295,9 +293,9 @@ describe "Project", ->
|
||||
paths = []
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /match/, ({path, match, range}) ->
|
||||
paths.push(path)
|
||||
matches.push(match)
|
||||
project.scan /match/, (result) ->
|
||||
paths.push(result.path)
|
||||
matches.push(result.match)
|
||||
|
||||
runs ->
|
||||
expect(paths.length).toBe 0
|
||||
@@ -311,9 +309,9 @@ describe "Project", ->
|
||||
paths = []
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /match this/, ({path, match, range}) ->
|
||||
paths.push(path)
|
||||
matches.push(match)
|
||||
project.scan /match this/, (result) ->
|
||||
paths.push(result.path)
|
||||
matches.push(result.match)
|
||||
|
||||
runs ->
|
||||
expect(paths.length).toBe 1
|
||||
@@ -328,9 +326,9 @@ describe "Project", ->
|
||||
paths = []
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
project.scan /match/, ({path, match, range}) ->
|
||||
paths.push(path)
|
||||
matches.push(match)
|
||||
project.scan /match/, (result) ->
|
||||
paths.push(result.path)
|
||||
matches.push(result.match)
|
||||
|
||||
runs ->
|
||||
expect(paths.length).toBe 0
|
||||
|
||||
@@ -223,20 +223,20 @@ class Project
|
||||
scan: (regex, iterator) ->
|
||||
bufferedData = ""
|
||||
state = 'readingPath'
|
||||
path = null
|
||||
filePath = null
|
||||
|
||||
readPath = (line) ->
|
||||
if /^[0-9,; ]+:/.test(line)
|
||||
state = 'readingLines'
|
||||
else if /^:/.test line
|
||||
path = line.substr(1)
|
||||
filePath = line.substr(1)
|
||||
else
|
||||
path += ('\n' + line)
|
||||
filePath += ('\n' + line)
|
||||
|
||||
readLine = (line) ->
|
||||
if line.length == 0
|
||||
state = 'readingPath'
|
||||
path = null
|
||||
filePath = null
|
||||
else
|
||||
colonIndex = line.indexOf(':')
|
||||
matchInfo = line.substring(0, colonIndex)
|
||||
@@ -251,7 +251,7 @@ class Project
|
||||
for [column, length] in matchPositions
|
||||
range = new Range([row, column], [row, column + length])
|
||||
match = lineText.substr(column, length)
|
||||
iterator({path, range, match})
|
||||
iterator({path: filePath, range, match})
|
||||
|
||||
deferred = $.Deferred()
|
||||
errors = []
|
||||
|
||||
Reference in New Issue
Block a user