Skip to content

Commit

Permalink
Don't assume the present working directory is the sass-spec directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseppstein committed Mar 14, 2016
1 parent 9a3bf83 commit d69aad0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/sass_spec/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def run_spec_test(test_case, options = {})
expected_error_msg = expected_error_line.rstrip
break
end
error_msg = _clean_debug_path(error_msg)
expected_error_msg = _clean_debug_path(expected_error_msg)
error_msg = _clean_debug_path(error_msg, options[:spec_directory])
expected_error_msg = _clean_debug_path(expected_error_msg, options[:spec_directory])
assert_equal expected_error_msg, error_msg, "Expected did not match error"
rescue StopIteration
assert_equal expected_error_msg, nil, "No error message produced"
Expand All @@ -138,13 +138,12 @@ def run_spec_test(test_case, options = {})
end
end

def _clean_debug_path(error)
pwd = Dir.pwd
url = pwd.gsub(/\\/, '\/')
def _clean_debug_path(error, spec_dir)
url = spec_dir.gsub(/\\/, '\/')
error.gsub(/^.*?(input.scss:\d+ DEBUG:)/, '\1')
.gsub(/\/+/, "/")
.gsub(/#{Regexp.quote(url)}\//, "/sass/sass-spec/")
.gsub(/#{Regexp.quote(pwd)}\//, "/sass/sass-spec/")
.gsub(/#{Regexp.quote(spec_dir)}\//, "/sass/sass-spec/")
.gsub(/(?:\/todo_|_todo\/)/, "/")
.gsub(/\/libsass\-[a-z]+\-tests\//, "/")
.gsub(/\/libsass\-[a-z]+\-issues/, "/libsass-issues")
Expand Down

0 comments on commit d69aad0

Please sign in to comment.