From a1221d005e01f1eff985b7e2f825ceb1dda4e3ed Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Wed, 9 Apr 2014 13:10:32 -0700 Subject: dos2unix: add tests for all executables Closes #28283. Signed-off-by: Brett Koonce --- Library/Formula/dos2unix.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Library/Formula/dos2unix.rb') diff --git a/Library/Formula/dos2unix.rb b/Library/Formula/dos2unix.rb index 68a8862d8..70c7844c3 100644 --- a/Library/Formula/dos2unix.rb +++ b/Library/Formula/dos2unix.rb @@ -24,9 +24,23 @@ class Dos2unix < Formula end test do + # write a file with lf path = testpath/"test.txt" - path.write "foo\r\nbar\r\n" + path.write "foo\nbar\n" + # unix2mac: convert lf to cr + system "#{bin}/unix2mac", path + assert_equal "foo\rbar\r", path.read + + # mac2unix: convert cr to lf + system "#{bin}/mac2unix", path + assert_equal "foo\nbar\n", path.read + + # unix2dos: convert lf to cr+lf + system "#{bin}/unix2dos", path + assert_equal "foo\r\nbar\r\n", path.read + + # dos2unix: convert cr+lf to lf system "#{bin}/dos2unix", path assert_equal "foo\nbar\n", path.read end -- cgit v1.2.3