blob: a3596d8e557847a4cfaf38f720a2b869335c674a (
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
|
# frozen_string_literal: false
require_relative 'base'
class TestMkmf
class TestFlags < TestMkmf
def test_valid_warnflags
val = $extmk
warnflags = $warnflags
makefile = mkmf do
$extmk = false
self.class::CONFIG['warnflags'] = %w"-Wextra
-Wno-unused-parameter -Wno-parentheses -Wno-long-long
-Wno-missing-field-initializers -Werror=pointer-arith
-Werror=write-strings -Werror=declaration-after-statement
-Werror=shorten-64-to-32
-Werror-implicit-function-declaration
".join(' ')
self.class::CONFIG['GCC'] = 'yes'
init_mkmf(self.class::CONFIG)
configuration '.'
end
generated_flags = makefile.grep(/warnflags/).first[/^warnflags = (.*)$/, 1].split
assert_equal %w"
-Wextra -Wno-unused-parameter -Wno-parentheses
-Wno-long-long -Wno-missing-field-initializers -Wpointer-arith
-Wwrite-strings -Wdeclaration-after-statement
-Wshorten-64-to-32 -Wimplicit-function-declaration
", generated_flags
ensure
$warnflags = warnflags
$extmk = val
end
def test_try_ldflag_invalid_opt
assert_separately([], <<-'end;') #do
assert(!try_ldflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
def test_try_cflag_invalid_opt
assert_separately([], <<-'end;', timeout: 30) #do
assert(!try_cflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
def test_try_cppflag_invalid_opt
assert_separately([], <<-'end;') #do
assert(!try_cppflags("nosuch.c"), TestMkmf::MKMFLOG)
assert(have_devel?, TestMkmf::MKMFLOG)
end;
end
end
end
|