aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/dos2unix.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula/dos2unix.rb')
-rw-r--r--Library/Formula/dos2unix.rb16
1 files changed, 15 insertions, 1 deletions
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