Skip to content

Commit

Permalink
Sort tests in test_rake_test_task
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Jun 23, 2011
1 parent f187817 commit 3fbd677
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions test/test_rake_test_task.rb
Expand Up @@ -28,13 +28,6 @@ def test_initialize_override
assert Task.task_defined?(:example)
end

def test_pattern_equals
tt = Rake::TestTask.new do |t|
t.pattern = '*.rb'
end
assert_equal ['*.rb'], tt.file_list.to_a
end

def test_file_list_ENV_TEST
ENV['TEST'] = 'testfile.rb'
tt = Rake::TestTask.new do |t|
Expand All @@ -46,12 +39,29 @@ def test_file_list_ENV_TEST
ENV.delete 'TEST'
end

def test_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
def test_libs_equals
test_task = Rake::TestTask.new do |t|
t.libs << ["A", "B"]
end

assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
path = %w[lib A B].join File::PATH_SEPARATOR

assert_equal "-I\"#{path}\"", test_task.ruby_opts_string
end

def test_libs_equals_empty
test_task = Rake::TestTask.new do |t|
t.libs = []
end

assert_equal '', test_task.ruby_opts_string
end

def test_pattern_equals
tt = Rake::TestTask.new do |t|
t.pattern = '*.rb'
end
assert_equal ['*.rb'], tt.file_list.to_a
end

def test_pattern_equals_test_files_equals
Expand All @@ -70,6 +80,14 @@ def test_run_code_direct
assert_equal '-e "ARGV.each{|f| require f}"', test_task.run_code
end

def test_run_code_rake
test_task = Rake::TestTask.new do |t|
t.loader = :rake
end

assert_match(/-I".*?" ".*?"/, test_task.run_code)
end

def test_run_code_testrb_ruby_1_8_2
test_task = Rake::TestTask.new do |t|
t.loader = :testrb
Expand All @@ -90,30 +108,12 @@ def test_run_code_testrb_ruby_1_8_6
assert_match(/^-S testrb +$/, test_task.run_code)
end

def test_run_code_rake
test_task = Rake::TestTask.new do |t|
t.loader = :rake
end

assert_match(/-I".*?" ".*?"/, test_task.run_code)
end

def test_libs_equals
test_task = Rake::TestTask.new do |t|
t.libs << ["A", "B"]
end

path = %w[lib A B].join File::PATH_SEPARATOR

assert_equal "-I\"#{path}\"", test_task.ruby_opts_string
end

def test_libs_equals_empty
test_task = Rake::TestTask.new do |t|
t.libs = []
def test_test_files_equals
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
end

assert_equal '', test_task.ruby_opts_string
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
end

end
Expand Down

0 comments on commit 3fbd677

Please sign in to comment.