Fix typo in beautify-languages-spec, calling text.replace when not string

This commit is contained in:
Glavin Wiechert 2015-06-11 23:50:24 -03:00
parent 0df387dac3
commit 5094d76930
1 changed files with 12 additions and 10 deletions

View File

@ -156,6 +156,18 @@ describe "BeautifyLanguages", ->
beautifyCompleted = false beautifyCompleted = false
completionFun = (text) -> completionFun = (text) ->
expect(text instanceof Error).not.toEqual(true, text)
return beautifyCompleted = true if text instanceof Error
# logger.verbose(expectedTestPath, text) if ext is ".less"
# if text instanceof Error
# return beautifyCompleted = text # text == Error
expect(text).not.toEqual(null, "Language or Beautifier not found")
return beautifyCompleted = true if text is null
expect(typeof text).toEqual("string", "Text: #{text}")
return beautifyCompleted = true if typeof text isnt "string"
# Replace Newlines # Replace Newlines
text = text.replace(/(?:\r\n|\r|\n)/g, '\n') text = text.replace(/(?:\r\n|\r|\n)/g, '\n')
expectedContents = expectedContents\ expectedContents = expectedContents\
@ -168,17 +180,7 @@ describe "BeautifyLanguages", ->
text = text.replace(/(?:\ )/g, '') text = text.replace(/(?:\ )/g, '')
expectedContents = expectedContents\ expectedContents = expectedContents\
.replace(/(?:\ )/g, '') .replace(/(?:\ )/g, '')
# logger.verbose(expectedTestPath, text) if ext is ".less"
expect(text instanceof Error).not.toEqual(true, text)
return beautifyCompleted = true if text instanceof Error
# if text instanceof Error
# return beautifyCompleted = text # text == Error
expect(text).not.toEqual(null, "Language or Beautifier not found")
return beautifyCompleted = true if text is null
expect(typeof text).toEqual("string", "Text: #{text}")
return beautifyCompleted = true if typeof text isnt "string"
# Check for beautification errors # Check for beautification errors
if text isnt expectedContents if text isnt expectedContents
# console.warn(allOptions, text, expectedContents) # console.warn(allOptions, text, expectedContents)