File: test_flags.rb

package info (click to toggle)
jruby 1.7.26-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,572 kB
  • sloc: ruby: 669,910; java: 253,056; xml: 35,152; ansic: 9,187; yacc: 7,267; cpp: 5,244; sh: 1,036; makefile: 345; jsp: 48; tcl: 40
file content (35 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (5)
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
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
  end
end