1 # frozen_string_literal: false
2 require_relative 'base'
5 class TestFlags < TestMkmf
6 def test_valid_warnflags
11 self.class::CONFIG['warnflags'] = %w"-Wextra
12 -Wno-unused-parameter -Wno-parentheses -Wno-long-long
13 -Wno-missing-field-initializers -Werror=pointer-arith
14 -Werror=write-strings -Werror=declaration-after-statement
15 -Werror=shorten-64-to-32
16 -Werror-implicit-function-declaration
18 self.class::CONFIG['GCC'] = 'yes'
19 init_mkmf(self.class::CONFIG)
22 generated_flags = makefile.grep(/warnflags/).first[/^warnflags = (.*)$/, 1].split
25 -Wextra -Wno-unused-parameter -Wno-parentheses
26 -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith
27 -Wwrite-strings -Wdeclaration-after-statement
28 -Wshorten-64-to-32 -Wimplicit-function-declaration
32 $warnflags = warnflags
36 def test_try_ldflag_invalid_opt
37 assert_separately([], <<-'end;') #do
38 assert(!try_ldflags("nosuch.c"), TestMkmf::MKMFLOG)
39 assert(have_devel?, TestMkmf::MKMFLOG)
43 def test_try_cflag_invalid_opt
44 assert_separately([], <<-'end;', timeout: 30) #do
45 assert(!try_cflags("nosuch.c"), TestMkmf::MKMFLOG)
46 assert(have_devel?, TestMkmf::MKMFLOG)
50 def test_try_cppflag_invalid_opt
51 assert_separately([], <<-'end;') #do
52 assert(!try_cppflags("nosuch.c"), TestMkmf::MKMFLOG)
53 assert(have_devel?, TestMkmf::MKMFLOG)