blob: 884a7cd271530e0e8febd546591cd14c14dabaa5 (
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
|
require 'testing_env'
require 'extend/set'
require 'requirements/x11_dependency'
class X11DependencyTests < Test::Unit::TestCase
def test_eql_instances_are_eql
x = X11Dependency.new
y = X11Dependency.new
assert x.eql?(y)
assert y.eql?(x)
assert x.hash == y.hash
end
def test_not_eql_when_hashes_differ
x = X11Dependency.new("foo")
y = X11Dependency.new
assert x.hash != y.hash
assert !x.eql?(y)
assert !y.eql?(x)
end
def test_proxy_for
x = X11Dependency::Proxy.for("libpng")
assert_instance_of X11Dependency::Proxy::Libpng, x
assert_kind_of X11Dependency, x
end
def test_proxy_eql_instances_are_eql
x = X11Dependency::Proxy.for("libpng")
y = X11Dependency::Proxy.for("libpng")
assert x.eql?(y)
assert y.eql?(x)
assert x.hash == y.hash
end
def test_proxy_not_eql_when_hashes_differ
x = X11Dependency::Proxy.for("libpng")
y = X11Dependency::Proxy.for("fontconfig")
assert x.hash != y.hash
assert !x.eql?(y)
assert !y.eql?(x)
end
def test_x_never_eql_to_proxy_x11_dep
x = X11Dependency.new("libpng")
p = X11Dependency::Proxy.for("libpng")
assert !x.eql?(p)
assert !p.eql?(x)
end
def test_x_env
x = X11Dependency.new
x.stubs(:satisfied?).returns(true)
ENV.expects(:x11)
x.modify_build_environment
end
end
class X11DepCollectionTests < Test::Unit::TestCase
def setup
@set = ComparableSet.new
end
def test_x_can_coxist_with_proxy
@set << X11Dependency.new << X11Dependency::Proxy.for("libpng")
assert_equal 2, @set.count
end
def test_multiple_proxies_can_coexist
@set << X11Dependency::Proxy.for("libpng")
@set << X11Dependency::Proxy.for("fontconfig")
assert_equal 2, @set.count
end
end
|