@@ -18,7 +18,7 @@ def setup
1818
1919 @spec = util_spec "a"
2020
21- @builder = Gem ::Ext ::Builder . new @spec , ""
21+ @builder = Gem ::Ext ::Builder . new @spec
2222 end
2323
2424 def teardown
@@ -201,6 +201,56 @@ def test_build_extensions_install_ext_only
201201 Gem . configuration . install_extension_in_lib = @orig_install_extension_in_lib
202202 end
203203
204+ def test_build_multiple_extensions
205+ pend "terminates on mswin" if vc_windows? && ruby_repo?
206+
207+ extension_in_lib do
208+ @spec . extensions << "ext/Rakefile"
209+ @spec . extensions << "ext/extconf.rb"
210+
211+ ext_dir = File . join @spec . gem_dir , "ext"
212+
213+ FileUtils . mkdir_p ext_dir
214+
215+ extconf_rb = File . join ext_dir , "extconf.rb"
216+ rakefile = File . join ext_dir , "Rakefile"
217+
218+ File . open extconf_rb , "w" do |f |
219+ f . write <<-'RUBY'
220+ require 'mkmf'
221+
222+ create_makefile 'a'
223+ RUBY
224+ end
225+
226+ File . open rakefile , "w" do |f |
227+ f . write <<-RUBY
228+ task :default do
229+ FileUtils.touch File.join "#{ ext_dir } ", 'foo'
230+ end
231+ RUBY
232+ end
233+
234+ ext_lib_dir = File . join ext_dir , "lib"
235+ FileUtils . mkdir ext_lib_dir
236+ FileUtils . touch File . join ext_lib_dir , "a.rb"
237+ FileUtils . mkdir File . join ext_lib_dir , "a"
238+ FileUtils . touch File . join ext_lib_dir , "a" , "b.rb"
239+
240+ use_ui @ui do
241+ @builder . build_extensions
242+ end
243+
244+ assert_path_exist @spec . extension_dir
245+ assert_path_exist @spec . gem_build_complete_path
246+ assert_path_exist File . join @spec . gem_dir , "ext" , "foo"
247+ assert_path_exist File . join @spec . extension_dir , "gem_make.out"
248+ assert_path_exist File . join @spec . extension_dir , "a.rb"
249+ assert_path_exist File . join @spec . gem_dir , "lib" , "a.rb"
250+ assert_path_exist File . join @spec . gem_dir , "lib" , "a" , "b.rb"
251+ end
252+ end
253+
204254 def test_build_extensions_none
205255 use_ui @ui do
206256 @builder . build_extensions
0 commit comments