Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[0.7.0.dev] TESTOPT not working as expected anymore #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Earlopain opened this issue Mar 11, 2025 · 0 comments · Fixed by #95
Closed

[0.7.0.dev] TESTOPT not working as expected anymore #93

Earlopain opened this issue Mar 11, 2025 · 0 comments · Fixed by #95

Comments

@Earlopain
Copy link

Earlopain commented Mar 11, 2025

Hi,

with the changes to 0.7.0.dev, ruby-head has picked it up and CI started to fail when TESTOPT is specified. With this simple project structure:

# Rakefile
require "rake/testtask"
task default: %i[test]

Rake::TestTask.new(:test) do |t|
  t.test_files = FileList["test.rb"]
end
# Gemfile
source 'https://rubygems.org'

gem 'test-unit'
gem 'rake'
# test.rb
require "test/unit"

class FooTest < Test::Unit::TestCase
  def test_foo
    assert true
  end
end

Executing rake with TESTOPT=-v used to work and print the following:

$ TESTOPT=-v bundle exec rake
Loaded suite /home/user/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rake-13.2.1/lib/rake/rake_test_loader
Started
FooTest: 
  test_foo:                                                                                                                             .: (0.000244)

Finished in 0.000784639 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------------
1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------
1274.47 tests/s, 1274.47 assertions/s

Now, when using optparse from master the following is printed:

$ TESTOPT=-v bundle exec rake
invalid argument: -v 
Test::Unit automatic runner.
Usage: /home/user/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb [options] [-- untouched arguments]
    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], e[macs], x[ml])
        (more available options)
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).

rake aborted!
Command failed with status (1)
/home/user/.rbenv/versions/3.4.2/bin/bundle:25:in 'Kernel#load'
/home/user/.rbenv/versions/3.4.2/bin/bundle:25:in '<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)

I have bisected it to the following commit: 050a87d (#91)

byroot added a commit to ruby/json that referenced this issue Mar 12, 2025
Workaround a regression in ruby-head: ruby/optparse#93
nobu added a commit that referenced this issue Mar 17, 2025
@nobu nobu closed this as completed in a8d0ba8 Mar 17, 2025
matzbot pushed a commit to ruby/ruby that referenced this issue Mar 17, 2025
Enum array may be the list of pairs of key and value.  Check if only
key is completable, not pair.

Fix ruby/optparse#93
Fix ruby/optparse#94

ruby/optparse@a8d0ba8dac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant