diff --git a/Library/Homebrew/test/test_cmd_info.rb b/Library/Homebrew/test/test_cmd_info.rb new file mode 100644 index 0000000000..c9f66c4d8d --- /dev/null +++ b/Library/Homebrew/test/test_cmd_info.rb @@ -0,0 +1,19 @@ +require "testing_env" +require "cmd/info" +require "formula" + +class InfoCommandTests < Homebrew::TestCase + def test_github_remote_path + remote = "https://github.com/Homebrew/homebrew" + assert_equal "https://github.com/Homebrew/homebrew/blob/master/Formula/git.rb", + Homebrew.github_remote_path(remote, "Formula/git.rb") + assert_equal "https://github.com/Homebrew/homebrew/blob/master/Formula/git.rb", + Homebrew.github_remote_path("#{remote}.git", "Formula/git.rb") + + assert_equal "https://github.com/user/repo/blob/master/foo.rb", + Homebrew.github_remote_path("git@github.com:user/repo", "foo.rb") + + assert_equal "https://mywebsite.com/foo/bar.rb", + Homebrew.github_remote_path("https://mywebsite.com", "foo/bar.rb") + end +end diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 47a288d719..7f088c4c5b 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -287,6 +287,20 @@ class IntegrationCommandTests < Homebrew::TestCase def test_sh assert_match "Your shell has been configured", cmd("sh", {"SHELL" => "/usr/bin/true"}) + + def test_info + formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + content = <<-EOS.undent + class Testball < Formula + url "https://example.com/testball-0.1.tar.gz" + end + EOS + formula_file.write content + + assert_match "testball: stable 0.1", + cmd("info", "testball") + ensure + formula_file.unlink end def test_custom_command