tests: cmd/edit & cmd/info tests added

This commit is contained in:
Baptiste Fontaine 2016-01-19 23:53:28 +01:00
parent 861910b85f
commit 36c734b392
2 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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