diff options
| author | Baptiste Fontaine | 2016-01-15 15:48:37 +0100 |
|---|---|---|
| committer | Baptiste Fontaine | 2016-01-16 15:46:01 +0100 |
| commit | f41e0a6e6472e246710ff25dcf757f74fc41636f (patch) | |
| tree | d45867f522d680dcf2f15c6bcbe4c99676021674 /Library | |
| parent | 0fa731b0209abb8378f2680b03a73af993eaa26f (diff) | |
| download | brew-f41e0a6e6472e246710ff25dcf757f74fc41636f.tar.bz2 | |
tests: more integration tests
Closes Homebrew/homebrew#48124.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 8ca7b3991..802b28335 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -106,6 +106,11 @@ class IntegrationCommandTests < Homebrew::TestCase cmd("help") end + def test_config + assert_match "HOMEBREW_VERSION: #{HOMEBREW_VERSION}", + cmd("config") + end + def test_install assert_match "#{HOMEBREW_CELLAR}/testball/0.1", cmd("install", testball) ensure @@ -219,6 +224,66 @@ class IntegrationCommandTests < Homebrew::TestCase cmd_fail("doctor", "check_integration_test") end + def test_command + assert_equal "#{HOMEBREW_LIBRARY_PATH}/cmd/info.rb", + cmd("command", "info") + + assert_match "Unknown command", + cmd_fail("command", "I-don't-exist") + end + + def test_commands + assert_match "Built-in commands", + cmd("commands") + end + + def test_cat + 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_equal content.chomp, cmd("cat", "testball") + ensure + formula_file.unlink + end + + def test_desc + formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + content = <<-EOS.undent + class Testball < Formula + desc "Some test" + url "https://example.com/testball-0.1.tar.gz" + end + EOS + formula_file.write content + + assert_equal "testball: Some test", cmd("desc", "testball") + ensure + formula_file.unlink + end + + def test_edit + (HOMEBREW_REPOSITORY/".git").mkpath + formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + content = <<-EOS.undent + class Testball < Formula + url "https://example.com/testball-0.1.tar.gz" + # something here + end + EOS + formula_file.write content + + assert_match "# something here", + cmd("edit", "testball", {"EDITOR" => "/bin/cat"}) + ensure + formula_file.unlink + (HOMEBREW_REPOSITORY/".git").unlink + end + def test_custom_command mktmpdir do |path| cmd = "int-test-#{rand}" |
