Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Avoid hardcoded newline tests #72

Closed
wants to merge 1 commit into from

3 participants

Luis Lavena Tay Ray Chuan Jim Weirich
Luis Lavena

Add new_line helper to avoid usage of hardcoded newline evaluation in
tests.

Correct tests that presented this issue.

All tests pass:

ruby 1.9.3dev (2011-09-02 revision 33165) [i386-mingw32]
437 tests, 1250 assertions, 0 failures, 0 errors, 0 skips
Luis Lavena luislavena Avoid hardcoded newline tests
Add `new_line` helper to avoid usage of hardcoded newline evaluation in
tests.

Correct tests that presented this issue.
b9234a1
Tay Ray Chuan

@nobu Actually, I think we should just strip away the newline character(s) with String.chomp. The tests are not concerned with EOLs.

@luislavena you missed another \n instance just in the next test, test_egrep_with_error.

Tay Ray Chuan

@luislavena here's my take: #90

Tay Ray Chuan

This should be closed in light of #92.

Jim Weirich
Owner

egrep no longer opens files in binary mode, so this pull request was closed.

Thanks for the feedback.

Jim Weirich jimweirich closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 2, 2011
  1. Luis Lavena

    Avoid hardcoded newline tests

    luislavena authored
    Add `new_line` helper to avoid usage of hardcoded newline evaluation in
    tests.
    
    Correct tests that presented this issue.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +4 −0 test/helper.rb
  2. +2 −2 test/test_rake_file_list.rb
4 test/helper.rb
View
@@ -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'
4 test/test_rake_file_list.rb
View
@@ -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
@@ -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
Something went wrong with that request. Please try again.