| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 | require 'testing_env'
require 'formula'
require 'compat/formula_specialties'
require 'testball'
require 'keg'
class InstallTests < Homebrew::TestCase
  def temporary_install f
    f.prefix.mkpath
    keg = Keg.new(f.prefix)
    shutup do
      f.brew { f.install }
    end
    begin
      yield
    ensure
      keg.unlink
      keg.uninstall
      f.clear_cache
    end
    refute_predicate keg, :exist?
    refute_predicate f, :installed?
  end
  def test_a_basic_install
    f = Testball.new
    refute_predicate f, :installed?
    temporary_install f do
      # Test that things made it into the Keg
      assert_predicate f.bin, :directory?
      assert_equal 3, f.bin.children.length
      assert_predicate f.libexec, :directory?
      assert_equal 1, f.libexec.children.length
      refute_predicate f.prefix+'main.c', :exist?
      assert_predicate f, :installed?
      # Test that things make it into the Cellar
      keg = Keg.new f.prefix
      keg.link
      bin = HOMEBREW_PREFIX+"bin"
      assert_predicate bin, :directory?
      assert_equal 3, bin.children.length
    end
  end
  def test_script_install
    f = Class.new(ScriptFileFormula) do
      url "file://#{File.expand_path(__FILE__)}"
      version "1"
    end.new("test_script_formula", Pathname.new(__FILE__).expand_path, :stable)
    temporary_install(f) { assert_equal 1, f.bin.children.length }
  end
end
 |