aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/testball.rb
blob: f440a6ed9f2b63cb6ba091c0a6bb69ae84783ead (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
require 'formula'

class TestBall <Formula
  # name parameter required for some Formula::factory
  def initialize name=nil
    @url="file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
    @homepage = 'http://example.com/'
    super "testball"
  end
  def install
    prefix.install "bin"
    prefix.install "libexec"
  end
end

class TestBallWithRealPath < TestBall
  def initialize name=nil
    super "testballwithrealpath"
    @path = Pathname.new(__FILE__)
  end
end

class TestBallWithMirror < Formula
  # `url` is bogus---curl should fail to download it. The mirror is fine
  # though.
  url "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz"
  mirror "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"

  def initialize name=nil
    @homepage = 'http://example.com/'
    super "testballwithmirror"
  end
end

class ConfigureFails <Formula
  # name parameter required for some Formula::factory
  def initialize name=nil
    @url="file:///#{TEST_FOLDER}/tarballs/configure_fails.tar.gz"
    @homepage = 'http://example.com/'
    @version = '1.0.0'
    @md5 = '9385e1b68ab8af68ac2c35423443159b'
    super "configurefails"
  end

  def install
    system "./configure"
  end
end

class TestCompilerFailures < Formula
  def initialize name=nil
    @url="file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
    @homepage = 'http://example.com/'
    super "compilerfailures"
  end
end

class TestAllCompilerFailures < TestCompilerFailures
  fails_with :clang
  fails_with :llvm
  fails_with :gcc
end

class TestNoCompilerFailures < TestCompilerFailures
  fails_with(:clang) { build 42 }
  fails_with(:llvm) { build 42 }
  fails_with(:gcc) { build 42 }
end

class TestLLVMFailure < TestCompilerFailures
  fails_with :llvm
end

class TestMixedCompilerFailures < TestCompilerFailures
  fails_with(:clang) { build MacOS.clang_build_version }
  fails_with(:llvm) { build 42 }
  fails_with(:gcc) { build 5666 }
end

class TestMoreMixedCompilerFailures < TestCompilerFailures
  fails_with(:clang) { build 42 }
  fails_with(:llvm) { build 2336 }
  fails_with(:gcc) { build 5666 }
end

class TestEvenMoreMixedCompilerFailures < TestCompilerFailures
  fails_with :clang
  fails_with(:llvm) { build 2336 }
  fails_with(:gcc) { build 5648 }
end

class TestBlockWithoutBuildCompilerFailure < TestCompilerFailures
  fails_with :clang do
    cause "failure"
  end
end