From 126d3ad412f8bf4a1e12f2ad324bdc70d9ea3ce4 Mon Sep 17 00:00:00 2001 From: jimweirich Date: Sun, 25 Jul 2004 03:59:46 +0000 Subject: [PATCH 1/3] Revert 0712aed to 0f28752 --- lib/rake/testtask.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 4fb871e46..40218ae53 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -155,7 +155,7 @@ def file_list # :nodoc: else result = [] result += @test_files.to_a if @test_files - result << @pattern if @pattern + result += FileList[@pattern].to_a if @pattern result end end From c04b7bf32fefc760a046084923bc371ddeb1b20e Mon Sep 17 00:00:00 2001 From: Code Ass Date: Fri, 2 Sep 2016 04:36:23 +0900 Subject: [PATCH 2/3] Fix t.pattern test, it supports glob --- test/test_rake_test_task.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_rake_test_task.rb b/test/test_rake_test_task.rb index 9b3450334..8d25c3d05 100644 --- a/test/test_rake_test_task.rb +++ b/test/test_rake_test_task.rb @@ -82,18 +82,24 @@ def test_libs_equals_empty end def test_pattern_equals + ['gl.rb', 'ob.rb'].each do |f| + create_file(f) + end tt = Rake::TestTask.new do |t| t.pattern = "*.rb" end - assert_equal ["*.rb"], tt.file_list.to_a + assert_equal ["gl.rb", "ob.rb"], tt.file_list.to_a end def test_pattern_equals_test_files_equals + ['gl.rb', 'ob.rb'].each do |f| + create_file(f) + end tt = Rake::TestTask.new do |t| t.test_files = FileList["a.rb", "b.rb"] t.pattern = "*.rb" end - assert_equal ["a.rb", "b.rb", "*.rb"], tt.file_list.to_a + assert_equal ["a.rb", "b.rb", "gl.rb", "ob.rb"], tt.file_list.to_a end def test_run_code_direct From 5123a749b9a98adfe61373e0cfb7aea35ac10b9f Mon Sep 17 00:00:00 2001 From: Code Ass Date: Mon, 12 Sep 2016 01:49:15 +0900 Subject: [PATCH 3/3] Add test for Rake::TestTask#loader is :direct and file set not given --- test/test_rake_test_task.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_rake_test_task.rb b/test/test_rake_test_task.rb index 8d25c3d05..196c7fb54 100644 --- a/test/test_rake_test_task.rb +++ b/test/test_rake_test_task.rb @@ -103,11 +103,19 @@ def test_pattern_equals_test_files_equals end def test_run_code_direct + globbed = ['test_gl.rb', 'test_ob.rb'].map { |f| File.join('test', f) } + others = ['a.rb', 'b.rb'].map { |f| File.join('test', f) } + (globbed + others).each do |f| + create_file(f) + end test_task = Rake::TestTask.new do |t| t.loader = :direct + # if t.pettern and t.test_files are nil, + # t.pettern is "test/test*.rb" end assert_equal '-e "ARGV.each{|f| require f}"', test_task.run_code + assert_equal globbed, test_task.file_list.to_a end def test_run_code_rake