aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBaptiste Fontaine2016-01-19 23:53:28 +0100
committerBaptiste Fontaine2016-01-20 20:15:34 +0100
commit36c734b392cb08a1a7d0e5a3184b52d258bbf0cf (patch)
tree5c86391e566ff5d8c85fd63681ac1c5c21f14e43 /Library
parent861910b85fd1521b14b0c40ec1013b229d1061ff (diff)
downloadbrew-36c734b392cb08a1a7d0e5a3184b52d258bbf0cf.tar.bz2
tests: cmd/edit & cmd/info tests added
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_cmd_info.rb19
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb14
2 files changed, 33 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_cmd_info.rb b/Library/Homebrew/test/test_cmd_info.rb
new file mode 100644
index 000000000..c9f66c4d8
--- /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 47a288d71..7f088c4c5 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