2626
2727TEST_PATH = File . dirname ( __FILE__ )
2828PKG_PATH = File . join ( File . dirname ( __FILE__ ) , '..' , 'pkg' )
29+ TEST_FILES = Dir [ "#{ TEST_PATH } /*_spec.rb" ]
2930
3031RSPEC = "rspec --default-path #{ TEST_PATH } -fd --color --seed 0"
3132
3637CMD
3738
3839SUITE_BREAK = "######################################################################\n "
39- GEM_BREAK = "----------------------------------------------------------------------\n "
4040
4141def platform_specific_extensions? ( platform = RUBY_PLATFORM )
4242 EXT_PLATFORMS . keys . include? ( platform ) &&
@@ -61,7 +61,8 @@ def install_java_gem_command
6161 "gem install #{ PKG_PATH } /concurrent-ruby-#{ Concurrent ::VERSION } -java.gem"
6262end
6363
64- def run_tests_cmd ( file , ext , platform = '' )
64+ def run_test_suite ( files , ext , platform = '' )
65+
6566 test_platform = if ext
6667 'EXT'
6768 elsif jruby? ( platform )
@@ -75,31 +76,26 @@ def run_tests_cmd(file, ext, platform = '')
7576 else
7677 install_gems_command ( ext , platform )
7778 end
79+ ok = system ( cmd )
7880
79- cmd << "\n "
80- cmd << "TEST_PLATFORM='#{ test_platform } ' #{ RSPEC } #{ file } "
81- cmd << "\n "
82- cmd << UNINSTALL_GEMS_COMMAND
83- cmd
84- end
81+ files . each do |file |
82+ cmd = "TEST_PLATFORM='#{ test_platform } ' #{ RSPEC } #{ file } "
83+ ok = system ( cmd )
84+ end
8585
86- TESTS = Dir [ " #{ TEST_PATH } /*_spec.rb" ]
87- ok = system ( UNINSTALL_GEMS_COMMAND )
86+ ok = system ( UNINSTALL_GEMS_COMMAND )
87+ end
8888
89- TESTS . each do |file |
89+ puts SUITE_BREAK
90+ run_test_suite ( TEST_FILES , false )
91+ if jruby?
92+ puts SUITE_BREAK
93+ run_test_suite ( TEST_FILES , false , 'jruby' )
94+ elsif mri?
9095 puts SUITE_BREAK
91- puts "Running #{ file } "
92- puts GEM_BREAK
93- ok = system ( run_tests_cmd ( file , false ) )
94- if jruby?
95- puts GEM_BREAK
96- ok = system ( run_tests_cmd ( file , false , 'jruby' ) )
97- elsif mri?
98- puts GEM_BREAK
99- ok = system ( run_tests_cmd ( file , true ) )
100- if platform_specific_extensions? ( RUBY_PLATFORM )
101- puts GEM_BREAK
102- ok = system ( run_tests_cmd ( file , true , RUBY_PLATFORM ) )
103- end
96+ run_test_suite ( TEST_FILES , true )
97+ if platform_specific_extensions? ( RUBY_PLATFORM )
98+ puts SUITE_BREAK
99+ run_test_suite ( TEST_FILES , true , RUBY_PLATFORM )
104100 end
105101end
0 commit comments