Skip to content

Commit

Permalink
Avoid hardcoded newline tests
Browse files Browse the repository at this point in the history
Add `new_line` helper to avoid usage of hardcoded newline evaluation in
tests.

Correct tests that presented this issue.
  • Loading branch information
luislavena committed Sep 2, 2011
1 parent 47c6d8a commit b9234a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def ignore_deprecations
Rake.application.options.ignore_deprecate = false
end

def new_line
Rake.application.windows? ? "\r\n" : "\n"
end

def rake_system_dir
@system_dir = 'system'

Expand Down
4 changes: 2 additions & 2 deletions test/test_rake_file_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def test_egrep_with_output
files.egrep(/XYZZY/)
end

assert_equal "xyzzy.txt:2:XYZZY\n", out
assert_equal "xyzzy.txt:2:XYZZY#{new_line}", out
end

def test_egrep_with_block
Expand All @@ -353,7 +353,7 @@ def test_egrep_with_block
found = [fn, ln, line]
end

assert_equal ["xyzzy.txt", 2, "XYZZY\n"], found
assert_equal ["xyzzy.txt", 2, "XYZZY#{new_line}"], found
end

def test_egrep_with_error
Expand Down

0 comments on commit b9234a1

Please sign in to comment.