diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_utils.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_utils.rb b/Library/Homebrew/test/test_utils.rb index fe6bab2b9..a64e81fa2 100644 --- a/Library/Homebrew/test/test_utils.rb +++ b/Library/Homebrew/test/test_utils.rb @@ -42,6 +42,20 @@ class UtilTests < Homebrew::TestCase which(File.basename(cmd), "~~#{File::PATH_SEPARATOR}#{File.dirname(cmd)}") end + def test_which_all + (@dir/"bar/baz").mkpath + cmd1 = @dir/"foo" + cmd2 = @dir/"bar/foo" + cmd3 = @dir/"bar/baz/foo" + FileUtils.touch cmd2 + [cmd1, cmd3].each do |cmd| + FileUtils.touch cmd + cmd.chmod 0744 + end + assert_equal [cmd3, cmd1], + which_all("foo", "#{@dir}/bar/baz:#{@dir}/baz:#{@dir}:~baduserpath") + end + def test_popen_read out = Utils.popen_read("/bin/sh", "-c", "echo success").chomp assert_equal "success", out |
