blob: 6e34ee7e4676cef91e9b8c0b80f696e7d62e48c1 (
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
|
require 'rubygems/test_case'
require 'rubygems/ext'
class TestGemExtBuilder < Gem::TestCase
def setup
super
@ext = File.join @tempdir, 'ext'
@dest_path = File.join @tempdir, 'prefix'
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
@orig_DESTDIR = ENV['DESTDIR']
end
def teardown
ENV['DESTDIR'] = @orig_DESTDIR
super
end
def test_class_make
ENV['DESTDIR'] = 'destination'
results = []
Dir.chdir @ext do
open 'Makefile', 'w' do |io|
io.puts <<-MAKEFILE
all:
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
install:
\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}"
MAKEFILE
end
Gem::Ext::Builder.make @dest_path, results
end
results = results.join "\n"
if RUBY_VERSION > '2.0' then
assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
else
refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results
refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results
end
if /nmake/ !~ results
assert_match %r%^all: destination$%, results
assert_match %r%^install: destination$%, results
end
end
end
|