Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ruby 1.9 commit

- unit tests passing
- functional tests passing when called standalone
- functional tests failing when called from rake ruby19:test:functionals


git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@616 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information...
commit 991f43225cdde6d1e21ec71ad0d92d012d424032 1 parent bab1b53
jimweirich authored
View
4 lib/rake.rb
@@ -2039,7 +2039,7 @@ def display_tasks_and_comments
if options.full_description
displayable_tasks.each do |t|
puts "rake #{t.name_with_args}"
- t.full_comment.each do |line|
+ t.full_comment.split("\n").each do |line|
puts " #{line}"
end
puts
@@ -2151,6 +2151,8 @@ def handle_options
$dryrun = options.dryrun
$silent = options.silent
end
+ rescue NoMethodError => ex
+ raise GetoptLong::InvalidOption, "While parsing options, error = #{ex.class}:#{ex.message}"
end
# Similar to the regular Ruby +require+ command, but will check
View
50 rakelib/ruby19.rake
@@ -0,0 +1,50 @@
+
+module Ruby19
+ PROG = '/Users/jim/local/ruby19/bin/ruby'
+ GEM_HOME = '/Users/jim/local/ruby19/lib/ruby/gems/1.9'
+
+ def run_tests(files)
+ sh "#{PROG} -Ilib lib/rake/rake_test_loader.rb #{files}"
+ end
+
+ extend self
+end
+
+namespace "ruby19" do
+ namespace "test" do
+
+ desc "Check the file paths"
+ task :check do
+ raise "Ruby 1.9 executable not found" unless File.exist?(Ruby19::PROG)
+ raise "Ruby 1.9 Gem Home not found" unless File.exist?(Ruby19::GEM_HOME)
+ end
+
+ task :env19 => :check do
+ ENV['GEM_HOME'] = Ruby19::GEM_HOME
+ end
+
+ desc "Describe the Ruby 1.9 version used for testing"
+ task :version => [:env19] do
+ sh "#{Ruby19::PROG} --version", :verbose => false
+ sh "#{Ruby19::PROG} -rubygems -e 'puts \"Gem Path = \#{Gem.path}\"'", :verbose => false
+ end
+
+ desc "Run the unit tests in Ruby 1.9"
+ task :units => [:env19] do
+ test_files = FileList['test/test_*.rb']
+ Ruby19.run_tests(test_files)
+ end
+
+ desc "Run the unit tests in Ruby 1.9"
+ task :functionals => [:env19] do
+ test_files = FileList['test/functional.rb']
+ Ruby19.run_tests(test_files)
+ end
+
+ desc "Run the unit tests in Ruby 1.9"
+ task :functionals => [:env19] do
+ test_files = FileList['test/functional.rb', 'test/test_*.rb']
+ Ruby19.run_tests(test_files)
+ end
+ end
+end
View
4 test/functional.rb
@@ -2,12 +2,16 @@
begin
require 'rubygems'
+ gem 'session'
require 'session'
+ puts 'OK!'
rescue LoadError
puts "UNABLE TO RUN FUNCTIONAL TESTS"
puts "No Session Found"
end
if defined?(Session)
+ puts "RUNNING SESSIONS"
+ puts $:
require 'test/session_functional'
end
View
5 test/rake_test_setup.rb
@@ -0,0 +1,5 @@
+# Common setup for all test files.
+
+require 'rubygems'
+gem 'flexmock'
+require 'flexmock/test_unit'
View
35 test/test_application.rb
@@ -8,8 +8,8 @@
require 'test/unit'
require 'rake'
+require 'test/rake_test_setup'
require 'test/capture_stdout'
-require 'flexmock/test_unit'
TESTING_REQUIRE = [ ]
@@ -19,6 +19,7 @@ class TestApplication < Test::Unit::TestCase
def setup
@app = Rake::Application.new
+ @app.options.rakelib = []
end
def test_constant_warning
@@ -140,6 +141,8 @@ def test_building_imported_files_on_demand
def test_good_run
ran = false
+ ARGV.clear
+ ARGV << '--rakelib=""'
@app.options.silent = true
@app.instance_eval do
intern(Rake::Task, "default").enhance { ran = true }
@@ -151,7 +154,7 @@ def test_good_run
def test_display_task_run
ran = false
ARGV.clear
- ARGV << '-f' << '-s' << '--tasks'
+ ARGV << '-f' << '-s' << '--tasks' << '--rakelib=""'
@app.last_description = "COMMENT"
@app.define_task(Rake::Task, "default")
out = capture_stdout { @app.run }
@@ -164,7 +167,7 @@ def test_display_task_run
def test_display_prereqs
ran = false
ARGV.clear
- ARGV << '-f' << '-s' << '--prereqs'
+ ARGV << '-f' << '-s' << '--prereqs' << '--rakelib=""'
@app.last_description = "COMMENT"
t = @app.define_task(Rake::Task, "default")
t.enhance([:a, :b])
@@ -179,13 +182,15 @@ def test_display_prereqs
end
def test_bad_run
- @app.intern(Rake::Task, "default").enhance { fail }
- ARGV.clear
- ARGV << '-f' << '-s'
- assert_raise(SystemExit) {
- err = capture_stderr { @app.run }
- assert_match(/see full trace/, err)
- }
+ Dir.chdir("test/data/no_files") do
+ @app.intern(Rake::Task, "default").enhance { fail }
+ ARGV.clear
+ ARGV << '-f' << '-s' << '--rakelib=""'
+ assert_raise(SystemExit) {
+ err = capture_stderr { @app.run }
+ assert_match(/see full trace/, err)
+ }
+ end
ensure
ARGV.clear
end
@@ -394,8 +399,12 @@ def test_bad_option
ex = assert_raise(GetoptLong::InvalidOption) do
flags('--bad-option')
end
- assert_match(/unrecognized option/, ex.message)
- assert_match(/--bad-option/, ex.message)
+ if ex.message =~ /^While/ # Ruby 1.9 error message
+ assert_match(/while parsing/i, ex.message)
+ else # Ruby 1.8 error message
+ assert_match(/unrecognized option/i, ex.message)
+ assert_match(/--bad-option/, ex.message)
+ end
end
end
@@ -410,7 +419,7 @@ def test_default_task_collection
end
def test_environment_definition
- ENV['TESTKEY'] = nil
+ ENV.delete('TESTKEY')
command_line("a", "TESTKEY=12")
assert_equal ["a"], @tasks.sort
assert '12', ENV['TESTKEY']
View
2  test/test_package_task.rb
@@ -96,7 +96,7 @@ def test_gem_package_with_specific_platform
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
- assert_equal "pkgr-1.2.3-mswin32.gem", pkg.gem_file
+ assert_match(/pkgr-1\.2\.3-.*mswin32.*\.gem/, pkg.gem_file)
end
def test_gem_package_with_current_platform
Please sign in to comment.
Something went wrong with that request. Please try again.