aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_utils.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_utils.rb b/Library/Homebrew/test/test_utils.rb
index a64e81fa2..bff6c6dd2 100644
--- a/Library/Homebrew/test/test_utils.rb
+++ b/Library/Homebrew/test/test_utils.rb
@@ -62,6 +62,21 @@ class UtilTests < Homebrew::TestCase
assert_predicate $?, :success?
end
+ def test_popen_read_with_block
+ out = Utils.popen_read("/bin/sh", "-c", "echo success") do |pipe|
+ pipe.read.chomp
+ end
+ assert_equal "success", out
+ assert_predicate $?, :success?
+ end
+
+ def test_popen_write_with_block
+ Utils.popen_write("/usr/bin/grep", "-q", "success") do |pipe|
+ pipe.write("success\n")
+ end
+ assert_predicate $?, :success?
+ end
+
def test_pretty_duration
assert_equal "1 second", pretty_duration(1)
assert_equal "2 seconds", pretty_duration(2.5)