26
26
27
27
TEST_PATH = File . dirname ( __FILE__ )
28
28
PKG_PATH = File . join ( File . dirname ( __FILE__ ) , '..' , 'pkg' )
29
+ TEST_FILES = Dir [ "#{ TEST_PATH } /*_spec.rb" ]
29
30
30
31
RSPEC = "rspec --default-path #{ TEST_PATH } -fd --color --seed 0"
31
32
36
37
CMD
37
38
38
39
SUITE_BREAK = "######################################################################\n "
39
- GEM_BREAK = "----------------------------------------------------------------------\n "
40
40
41
41
def platform_specific_extensions? ( platform = RUBY_PLATFORM )
42
42
EXT_PLATFORMS . keys . include? ( platform ) &&
@@ -61,7 +61,8 @@ def install_java_gem_command
61
61
"gem install #{ PKG_PATH } /concurrent-ruby-#{ Concurrent ::VERSION } -java.gem"
62
62
end
63
63
64
- def run_tests_cmd ( file , ext , platform = '' )
64
+ def run_test_suite ( files , ext , platform = '' )
65
+
65
66
test_platform = if ext
66
67
'EXT'
67
68
elsif jruby? ( platform )
@@ -75,31 +76,26 @@ def run_tests_cmd(file, ext, platform = '')
75
76
else
76
77
install_gems_command ( ext , platform )
77
78
end
79
+ ok = system ( cmd )
78
80
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
85
85
86
- TESTS = Dir [ " #{ TEST_PATH } /*_spec.rb" ]
87
- ok = system ( UNINSTALL_GEMS_COMMAND )
86
+ ok = system ( UNINSTALL_GEMS_COMMAND )
87
+ end
88
88
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?
90
95
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 )
104
100
end
105
101
end
0 commit comments