1.9.3-preview1 & rake & Test::Unit

Is there something changed between 1.9.2 and 1.9.3-preview1 in
Test::Unit and/or rake?

I have this in my Rakefile, works fine in 1.9.2-p290 and fails in
1.9.3-preview1...

desc "Run basic tests"
Rake::TestTask.new("test_units") { |t|
  t.pattern = 'test/test_*.rb'
  t.verbose = true
  t.warning = true
}

1.9.2:
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -w -I"lib"
-I"/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib"
"/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_test_loader.rb"
"test/test_*.rb"
Loaded suite
/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
..................................................................................
Finished in 0.081080 seconds.

82 tests, 494 assertions, 0 failures, 0 errors, 0 skips

1.9.3:
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:167:in
`block in non_options': file not found: test/test_*.rb (ArgumentError)
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:146:in
`map!'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:146:in
`non_options'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:207:in
`non_options'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:52:in
`process_args'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/minitest/unit.rb:891:in
`_run'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/minitest/unit.rb:884:in
`run'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:21:in
`run'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:326:in
`block (2 levels) in autorun'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:27:in
`run_once'
  from
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:325:in
`block in autorun'
rake aborted!

···

--
Posted via http://www.ruby-forum.com/.

You might be interested in the workaround mentioned in this bug ticket
until a fixed version is released:

···

On Thu, Aug 11, 2011 at 10:52:07PM +0900, Ollivier Robert wrote:

Is there something changed between 1.9.2 and 1.9.3-preview1 in
Test::Unit and/or rake?

I have this in my Rakefile, works fine in 1.9.2-p290 and fails in
1.9.3-preview1...

You aren't showing the full output nor the rake version nor ruby -v.

Ruby 1.9.3 preview 1 ships with rake 0.9.2.1 which does not have this bug. See:

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_9_3_preview1/lib/rake/rake_test_loader.rb?r1=32217&r2=32265

Which matches the fix from rake:

I can't reproduce:

$ find . -type f
./Rakefile
./test/test_a.rb
./test/test_b.rb
$ cat Rakefile
require 'rake/testtask'

desc "Run basic tests"
Rake::TestTask.new { |t|
t.pattern = 'test/test_*.rb'
t.verbose = true
t.warning = true
}

$ cat test/test_a.rb
require 'test/unit'

class TestA < Test::Unit::TestCase

  def test_a
    assert true
  end

end

$ cat test/test_b.rb
require 'test/unit'

class TestB < Test::Unit::TestCase

  def test_b
    refute true
  end

end

$ ~/.multiruby/install/1.9.3-preview1/bin/ruby -v
ruby 1.9.3dev (2011-07-31 revision 32789) [x86_64-darwin11.0.0]
$ ~/.multiruby/install/1.9.3-preview1/bin/rake --version
rake, version 0.9.2.1
$ ~/.multiruby/install/1.9.3-preview1/bin/gem list rake -d

*** LOCAL GEMS ***

rake (0.9.2.1)
    Author:
    Installed at: /Users/drbrain/.multiruby/install/1.9.3-preview1/lib/ruby/gems/1.9.1

    This rake is bundled with Ruby

$ ~/.multiruby/install/1.9.3-preview1/bin/rake test
/Users/drbrain/.multiruby/install/1.9.3-preview1/bin/ruby -w -I"lib" -I"/Users/drbrain/.multiruby/install/1.9.3-preview1/lib/ruby/1.9.1" "/Users/drbrain/.multiruby/install/1.9.3-preview1/lib/ruby/1.9.1/rake/rake_test_loader.rb" "test/test_*.rb"
Run options:

# Running tests:

.F

Finished tests in 0.003885s, 514.8005 tests/s, 514.8005 assertions/s.

  1) Failure:
test_b(TestB) [/Users/drbrain/tmp/t/test/test_b.rb:6]:
Failed refutation, no message given

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [/Users/drbrain/.multiruby/install/1.9.3-pr...]

Tasks: TOP => test
(See full trace by running task with --trace)

···

On Aug 11, 2011, at 6:52 AM, Ollivier Robert wrote:

Is there something changed between 1.9.2 and 1.9.3-preview1 in
Test::Unit and/or rake?

I have this in my Rakefile, works fine in 1.9.2-p290 and fails in
1.9.3-preview1...

desc "Run basic tests"
Rake::TestTask.new("test_units") { |t|
t.pattern = 'test/test_*.rb'
t.verbose = true
t.warning = true
}

1.9.2:
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -w -I"lib"
-I"/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib"
"/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_test_loader.rb"
"test/test_*.rb"
Loaded suite
/Volumes/Users/roberto/.rvm/gems/ruby-1.9.2-p290@ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
..................................................................................
Finished in 0.081080 seconds.

82 tests, 494 assertions, 0 failures, 0 errors, 0 skips

1.9.3:
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:167:in
`block in non_options': file not found: test/test_*.rb (ArgumentError)
from
[…]
/Volumes/Users/roberto/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:325:in
`block in autorun'
rake aborted!

Mark Somerville wrote in post #1016183:

You might be interested in the workaround mentioned in this bug ticket
until a fixed version is released:

Rake::TestTask pattern is not being expanded in 1.9.3 · Issue #51 · jimweirich/rake · GitHub

Indeed, workaround works, thanks!

···

--
Posted via http://www.ruby-forum.com/\.