Extract ruby_api_version_name

This commit is contained in:
Nobuyoshi Nakada 2025-08-14 09:10:12 +09:00 committed by Nobuyoshi Nakada
parent c8233db221
commit 9b576cd625
4 changed files with 23 additions and 16 deletions

View file

@ -47,26 +47,27 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err([], "", [], [])
end
version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
OPTIONS_LINK = "https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html"
def test_usage
assert_in_out_err(%w(-h)) do |r, e|
assert_operator(r.size, :<=, 26)
longer = r[3..-1].select {|x| x.size >= 80}
_, _, link, *r = r
assert_include(link, OPTIONS_LINK)
assert_operator(r.size, :<=, 24)
longer = r.select {|x| x.size >= 80}
assert_equal([], longer)
assert_equal([], e)
version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html")
end
end
def test_usage_long
assert_in_out_err(%w(--help)) do |r, e|
longer = r[3..-1].select {|x| x.size > 80}
_, _, link, *r = r
assert_include(link, OPTIONS_LINK)
longer = r.select {|x| x.size > 80}
assert_equal([], longer)
assert_equal([], e)
version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html")
end
end