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
|
require 'testing_env'
require 'software_spec'
class FailsWithTests < Homebrew::TestCase
def assert_fails_with(cc)
assert @spec.fails_with?(cc)
end
def refute_fails_with(cc)
refute @spec.fails_with?(cc)
end
def fails_with(*args, &block)
@spec.fails_with(*args, &block)
end
def build_cc(name, version)
Compiler.new(name, version)
end
def setup
@spec = SoftwareSpec.new
end
def test_fails_with_symbol
fails_with :clang
cc = build_cc(:clang, 425)
assert_fails_with cc
end
def test_fails_with_build
fails_with(:clang) { build 211 }
cc = build_cc(:clang, 318)
refute_fails_with cc
end
def test_fails_with_block_without_build
fails_with(:clang)
cc = build_cc(:clang, 425)
assert_fails_with cc
end
def test_non_apple_gcc_version
fails_with(:gcc => '4.8')
assert_fails_with build_cc("gcc-4.8", "4.8")
assert_fails_with build_cc("gcc-4.8", "4.8.1")
end
def test_multiple_failures
fails_with(:llvm)
fails_with(:clang)
gcc = build_cc(:gcc, 5666)
llvm = build_cc(:llvm, 2336)
clang = build_cc(:clang, 425)
assert_fails_with llvm
assert_fails_with clang
refute_fails_with gcc
end
def test_fails_with_version
fails_with(:gcc => '4.8') { version '4.8.1' }
assert_fails_with build_cc("gcc-4.8", "4.8")
assert_fails_with build_cc("gcc-4.8", "4.8.1")
refute_fails_with build_cc("gcc-4.8", "4.8.2")
end
end
|