aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/dos2unix.rb
diff options
context:
space:
mode:
authorMike Naberezny2014-04-09 13:10:32 -0700
committerBrett Koonce2014-04-09 22:42:30 -0500
commita1221d005e01f1eff985b7e2f825ceb1dda4e3ed (patch)
tree44eb628126636c3b70b73218e394f6e681339d2b /Library/Formula/dos2unix.rb
parent05418074d04f3f7b90b5aa4e38a5555dd0c8e9af (diff)
downloadhomebrew-a1221d005e01f1eff985b7e2f825ceb1dda4e3ed.tar.bz2
dos2unix: add tests for all executables
Closes #28283. Signed-off-by: Brett Koonce <koonce@gmail.com>
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