diff options
author | Jeremy Evans <[email protected]> | 2022-04-22 13:01:43 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2022-04-22 15:00:16 -0700 |
commit | ab3cb29bd9bff9c16cfb9d19cc02026998282c12 (patch) | |
tree | 6127856f758af8ff4b435f845c2777e0f478ca94 /test/mkmf/test_convertible.rb | |
parent | c2d38a0d2d78f749fba47073b33106fd2e57767a (diff) |
Avoid defining the same test class in multiple files
Should fix issues with parallel testing sometimes not running all
tests.
This should be viewed skipping whitespace changes.
Fixes [Bug #18731]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5839
Diffstat (limited to 'test/mkmf/test_convertible.rb')
-rw-r--r-- | test/mkmf/test_convertible.rb | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/test/mkmf/test_convertible.rb b/test/mkmf/test_convertible.rb index 1baf892842..d65db4265b 100644 --- a/test/mkmf/test_convertible.rb +++ b/test/mkmf/test_convertible.rb @@ -1,35 +1,33 @@ # frozen_string_literal: false require_relative 'base' -class TestMkmf - class TestConvertible < TestMkmf - def test_typeof_builtin - ["", ["signed ", ""], "unsigned "].each do |signed, prefix| - %w[short int long].each do |type| - assert_equal((prefix || signed)+type, - mkmf {convertible_int(signed+type)}, MKMFLOG) - end +class TestMkmfConvertible < TestMkmf + def test_typeof_builtin + ["", ["signed ", ""], "unsigned "].each do |signed, prefix| + %w[short int long].each do |type| + assert_equal((prefix || signed)+type, + mkmf {convertible_int(signed+type)}, MKMFLOG) end end + end - def test_typeof_typedef - ["", ["signed ", ""], "unsigned "].each do |signed, prefix| - %w[short int long].each do |type| - open("confdefs.h", "w") {|f| - f.puts "typedef #{signed}#{type} test1_t;" - } - $defs.clear - assert_equal((prefix || signed)+type, - mkmf {convertible_int("test1_t", "confdefs.h")}, MKMFLOG) - (u = signed[/^u/]) and u.upcase! - assert_include($defs, "-DTYPEOF_TEST1_T="+"#{prefix||signed}#{type}".quote) - assert_include($defs, "-DPRI_TEST1T_PREFIX=PRI_#{type.upcase}_PREFIX") - assert_include($defs, "-DTEST1T2NUM=#{u}#{type.upcase}2NUM") - assert_include($defs, "-DNUM2TEST1T=NUM2#{u}#{type.upcase}") - end + def test_typeof_typedef + ["", ["signed ", ""], "unsigned "].each do |signed, prefix| + %w[short int long].each do |type| + open("confdefs.h", "w") {|f| + f.puts "typedef #{signed}#{type} test1_t;" + } + $defs.clear + assert_equal((prefix || signed)+type, + mkmf {convertible_int("test1_t", "confdefs.h")}, MKMFLOG) + (u = signed[/^u/]) and u.upcase! + assert_include($defs, "-DTYPEOF_TEST1_T="+"#{prefix||signed}#{type}".quote) + assert_include($defs, "-DPRI_TEST1T_PREFIX=PRI_#{type.upcase}_PREFIX") + assert_include($defs, "-DTEST1T2NUM=#{u}#{type.upcase}2NUM") + assert_include($defs, "-DNUM2TEST1T=NUM2#{u}#{type.upcase}") end - ensure - File.unlink("confdefs.h") end + ensure + File.unlink("confdefs.h") end end |