<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/optparse/test_optparse.rb, branch v4.0.3</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/optparse] JRuby does not have EXECUTABLE_EXTS in RbConfg::CONFIG</title>
<updated>2025-06-29T07:52:46+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-06-29T07:50:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9598ed9d1c56e971e76d4bbbacef6ec9643e12dc'/>
<id>9598ed9d1c56e971e76d4bbbacef6ec9643e12dc</id>
<content type='text'>
https://github.com/ruby/optparse/commit/15b2f00b6b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/15b2f00b6b
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Fix OptionParser#program_name not to strip suffix unexpectedly</title>
<updated>2025-06-29T07:52:45+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-06-29T07:07:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=259b0233d826104840d0b52ebb14e0a3435d4497'/>
<id>259b0233d826104840d0b52ebb14e0a3435d4497</id>
<content type='text'>
https://github.com/ruby/optparse/commit/740ffa76c0
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/740ffa76c0
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Make the result of `tty?` obtainable with flexible stdout</title>
<updated>2025-03-10T10:19:58+00:00</updated>
<author>
<name>Koichi ITO</name>
<email>koic.ito@gmail.com</email>
</author>
<published>2025-02-02T07:17:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f4c16c57aad9138f236f4fa966893b21d5a64cbf'/>
<id>f4c16c57aad9138f236f4fa966893b21d5a64cbf</id>
<content type='text'>
In mock testing for stdout, `StringIO.new` is sometimes used to redirect the output.
In such cases, the assignment is done with `$stdout = StringIO.new`, not the constant `STDOUT`.
e.g., https://github.com/rubocop/rubocop/blob/v1.71.1/lib/rubocop/rspec/shared_contexts.rb#L154-L164

After assigning `StringIO.new`, `$stdout.tty?` returns `false`,
allowing the standard output destination to be switched during test execution.

```ruby
STDOUT.tty?       # =&gt; true
StringIO.new.tty? # =&gt; false
```

However, since `STDOUT.tty?` returns `true`, a failure occurred in environments
where the environment variables `RUBY_PAGER` or `PAGER` are set.
e.g., https://github.com/rubocop/rubocop/pull/13784

To address this, `STDOUT` has been updated to `$stdout` so that the result of `tty?` can be flexibly overridden.

A potential concern is that `$stdout`, unlike `STDOUT`,
does not always represent the standard output at the time the Ruby process started.
However, no concrete examples of issues related to this have been identified.

`STDOUT.tty?` is the logic of optparse introduced in https://github.com/ruby/optparse/pull/70.

This PR replaces `STDOUT` with `$stdout` throughout, based on the assumption
that `$stdout` is sufficient for use with optparse.

https://github.com/ruby/optparse/commit/262cf6f9ac
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In mock testing for stdout, `StringIO.new` is sometimes used to redirect the output.
In such cases, the assignment is done with `$stdout = StringIO.new`, not the constant `STDOUT`.
e.g., https://github.com/rubocop/rubocop/blob/v1.71.1/lib/rubocop/rspec/shared_contexts.rb#L154-L164

After assigning `StringIO.new`, `$stdout.tty?` returns `false`,
allowing the standard output destination to be switched during test execution.

```ruby
STDOUT.tty?       # =&gt; true
StringIO.new.tty? # =&gt; false
```

However, since `STDOUT.tty?` returns `true`, a failure occurred in environments
where the environment variables `RUBY_PAGER` or `PAGER` are set.
e.g., https://github.com/rubocop/rubocop/pull/13784

To address this, `STDOUT` has been updated to `$stdout` so that the result of `tty?` can be flexibly overridden.

A potential concern is that `$stdout`, unlike `STDOUT`,
does not always represent the standard output at the time the Ruby process started.
However, no concrete examples of issues related to this have been identified.

`STDOUT.tty?` is the logic of optparse introduced in https://github.com/ruby/optparse/pull/70.

This PR replaces `STDOUT` with `$stdout` throughout, based on the assumption
that `$stdout` is sufficient for use with optparse.

https://github.com/ruby/optparse/commit/262cf6f9ac
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Fix parsing array arguments with `:into` option</title>
<updated>2024-08-05T02:28:12+00:00</updated>
<author>
<name>fatkodima</name>
<email>fatkodima123@gmail.com</email>
</author>
<published>2024-08-05T02:28:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a35d32486242641ccd2ac98d43211343a3712c52'/>
<id>a35d32486242641ccd2ac98d43211343a3712c52</id>
<content type='text'>
https://github.com/ruby/optparse/commit/19700e96d8
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/19700e96d8
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Invoke pager for `--help`</title>
<updated>2024-03-01T07:10:08+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-02-29T16:24:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5d76fe6b2a413c71374c9f799c7a1023e2002457'/>
<id>5d76fe6b2a413c71374c9f799c7a1023e2002457</id>
<content type='text'>
https://github.com/ruby/optparse/commit/77dccce37c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/77dccce37c
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Add `exact:` keyword argument</title>
<updated>2024-02-23T12:16:59+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-02-21T04:42:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=41c0fb699139f82c92414638a7b31565d9841f1c'/>
<id>41c0fb699139f82c92414638a7b31565d9841f1c</id>
<content type='text'>
https://github.com/ruby/optparse/commit/07e83673a8
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/07e83673a8
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Respect default values in block parameters</title>
<updated>2024-02-09T10:58:19+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-02-09T03:59:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2c6767b71ef5154f49e4aef7a236849a934e68fb'/>
<id>2c6767b71ef5154f49e4aef7a236849a934e68fb</id>
<content type='text'>
Fix https://github.com/ruby/optparse/pull/55

https://github.com/ruby/optparse/commit/9d53e74aa4
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix https://github.com/ruby/optparse/pull/55

https://github.com/ruby/optparse/commit/9d53e74aa4
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Fix `require_exact` to work with options defined as `--[no]-something`</title>
<updated>2024-02-09T03:31:13+00:00</updated>
<author>
<name>fatkodima</name>
<email>fatkodima123@gmail.com</email>
</author>
<published>2023-10-14T18:52:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f7a407cabda6eb787fb95fc6e3c1b2215b1aec19'/>
<id>f7a407cabda6eb787fb95fc6e3c1b2215b1aec19</id>
<content type='text'>
https://github.com/ruby/optparse/commit/4e346ad337
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/4e346ad337
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] The encoding argument of `Regexp.new` has been ignored since 1.9</title>
<updated>2022-12-21T05:09:12+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-21T05:07:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=502ca37dde288d20fed6e6ea34f4ab3299de7777'/>
<id>502ca37dde288d20fed6e6ea34f4ab3299de7777</id>
<content type='text'>
https://github.com/ruby/optparse/commit/766f567405
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/optparse/commit/766f567405
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/optparse] Fix the test failure i ruby/ruby</title>
<updated>2022-11-28T16:20:40+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-11-28T16:14:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f3ad68dd161da60bb4f4908974839bb2b5736a85'/>
<id>f3ad68dd161da60bb4f4908974839bb2b5736a85</id>
<content type='text'>
```
$ make test-all TESTS=test/optparse/
...

[148/178] TestOptionParserDidYouMean#test_raise_unknown = 0.00 s
  1) Failure:
TestOptionParserDidYouMean#test_raise_unknown [/home/mame/work/ruby/test/optparse/test_optparse.rb:106]:
&lt;["--bar"]&gt; expected but was
&lt;[]&gt;.
```

In the old test/unit (bundled in ruby/ruby), when a test class inherits from
another test class, the child class runs all the tests defined in the parent
class.
However, it looks like the new test/unit does not do so. This is because the
test failure does not occur in ruby/optparse.

As a tentative solution, this changes the option names in TestOptionParser to
avoid the name conflict with TestOptionParserDidYouMean.

https://github.com/ruby/optparse/commit/fee86ef7a4
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
```
$ make test-all TESTS=test/optparse/
...

[148/178] TestOptionParserDidYouMean#test_raise_unknown = 0.00 s
  1) Failure:
TestOptionParserDidYouMean#test_raise_unknown [/home/mame/work/ruby/test/optparse/test_optparse.rb:106]:
&lt;["--bar"]&gt; expected but was
&lt;[]&gt;.
```

In the old test/unit (bundled in ruby/ruby), when a test class inherits from
another test class, the child class runs all the tests defined in the parent
class.
However, it looks like the new test/unit does not do so. This is because the
test failure does not occur in ruby/optparse.

As a tentative solution, this changes the option names in TestOptionParser to
avoid the name conflict with TestOptionParserDidYouMean.

https://github.com/ruby/optparse/commit/fee86ef7a4
</pre>
</div>
</content>
</entry>
</feed>
