From d6297bdefcf18d9689ebeea60734c842f21e96cc Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 10 Jun 2015 16:12:19 -0300 Subject: [PATCH] Replace invisible chars (space, tab, newline) w/ visible chars in specs --- spec/beautify-languages-spec.coffee | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/beautify-languages-spec.coffee b/spec/beautify-languages-spec.coffee index c20c1a6..3531272 100644 --- a/spec/beautify-languages-spec.coffee +++ b/spec/beautify-languages-spec.coffee @@ -152,7 +152,18 @@ describe "BeautifyLanguages", -> beautifyCompleted = false completionFun = (text) -> - console.log(text, expectedContents) + # Replace Newlines + text = text.replace(/(?:\r\n|\r|\n)/g, '⏎\n') + expectedContents = expectedContents\ + .replace(/(?:\r\n|\r|\n)/g, '⏎\n') + # Replace tabs + text = text.replace(/(?:\t)/g, '↹') + expectedContents = expectedContents\ + .replace(/(?:\t)/g, '↹') + # Replace spaces + text = text.replace(/(?:\ )/g, '␣') + expectedContents = expectedContents\ + .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