diff options
| author | Andrea Kao | 2016-06-19 14:20:20 -0700 |
|---|---|---|
| committer | Mike McQuaid | 2016-06-19 22:20:20 +0100 |
| commit | cad85754cf17c468ccda1d76022e680ba8c9455d (patch) | |
| tree | 4c2c1b94f305ddef508db088cd083aa749497ace | |
| parent | 595487796273467fdca73ab0adadf040bd664c6d (diff) | |
| download | brew-cad85754cf17c468ccda1d76022e680ba8c9455d.tar.bz2 | |
tests: add cmd/search integration test (#356)
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 4147ff87a..eb7afd972 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -797,4 +797,41 @@ class IntegrationCommandTests < Homebrew::TestCase cmd(cmd, {"PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"}) end end + + def test_search + formula_file = CoreTap.new.formula_dir/"testball.rb" + formula_file.write <<-EOS.undent + class Testball < Formula + desc "Some test" + url "https://example.com/testball-0.1.tar.gz" + end + EOS + + desc_cache = HOMEBREW_CACHE/"desc_cache.json" + refute_predicate desc_cache, :exist?, "Cached file should not exist" + + assert_match "testball", cmd("search") + assert_match "testball", cmd("search", "testball") + assert_match "testball", cmd("search", "homebrew/homebrew-core/testball") + assert_match "testball", cmd("search", "--desc", "Some test") + + flags = { + "macports" => "https://www.macports.org/ports.php?by=name&substr=testball", + "fink" => "http://pdb.finkproject.org/pdb/browse.php?summary=testball", + "debian" => "https://packages.debian.org/search?keywords=testball&searchon=names&suite=all§ion=all", + "opensuse" => "https://software.opensuse.org/search?q=testball", + "fedora" => "https://admin.fedoraproject.org/pkgdb/packages/%2Atestball%2A/", + "ubuntu" => "http://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all§ion=all", + } + + flags.each do |flag, url| + assert_equal url, cmd("search", "--#{flag}", + "testball", "HOMEBREW_BROWSER" => "echo") + end + + assert_predicate desc_cache, :exist?, "Cached file should exist" + ensure + desc_cache.unlink + formula_file.unlink + end end |
