Skip to content

Commit 2fef1b0

Browse files
committed
Update clean up function to bare minimum
1 parent db9f6f5 commit 2fef1b0

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

lib/sass_spec/test_case.rb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,26 +114,17 @@ def _norm_output(css)
114114
# but make sure we do not remove single cariage returns
115115
css = css.gsub(/(?:\r?\n)+/, "\n")
116116
end
117-
def _norm_error(err)
118-
# we dont want to test for linux or windows line-feeds
119-
# but make sure we do not remove single cariage returns
120-
err = err.gsub(/(?:\r?\n)+/, "\n")
121-
# remove all newlines at the end of the file
122-
err = err.sub(/(?:\r?\n)+\z/, "")
123-
end
124117

125118
# cleaning only happens when requested for test
126119
# done by creating `expected.type.clean` flag file
127120
def _clean_output(css)
128-
css.gsub(/ *\{/, " {\n")
129-
.gsub(/([;,]) */, "\\1\n")
130-
.gsub(/ *\} */, " }\n")
131-
.gsub(/;(?:\s*;)+/m, ";")
132-
.gsub(/;\r?\n }/m, " }")
133-
.gsub(/\r?\n/, "\n")
134-
.sub(/(?:\r?\n)+\z/, "")
135-
.strip
121+
_norm_output(css)
122+
.gsub(/[\r\n\s ]+/, " ")
123+
.gsub(/, /, ",")
136124
end
125+
126+
# errors are always cleaned
127+
# we also write them cleaned
137128
def _clean_error(err)
138129
err.gsub(/(?:\/todo_|_todo\/)/, "/") # hide todo pre/suffix
139130
.gsub(/\/libsass\-[a-z]+\-tests\//, "/") # hide test directory

0 commit comments

Comments
 (0)