diff options
| author | Martin Afanasjew | 2016-01-04 15:15:56 +0100 |
|---|---|---|
| committer | Martin Afanasjew | 2016-01-04 16:26:25 +0100 |
| commit | 74baec5e798a2bdec4f51b87bb495e5454460c70 (patch) | |
| tree | c2a27ce8b9017e71ea646898bfab99448146e5d1 /Library | |
| parent | cc632acd07d0884d51c5de414fcabd6e5f856fd2 (diff) | |
| download | brew-74baec5e798a2bdec4f51b87bb495e5454460c70.tar.bz2 | |
test: test popen_read and popen_write with block
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_utils.rb | 15 |
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) |
