Skip to content

Cleanup minitest code #735

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

Merged
merged 7 commits into from
Aug 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
home :: https://github.com/ruby/rdoc
rdoc :: https://ruby.github.io/rdoc
bugs :: https://github.com/ruby/rdoc/issues
build status :: {<img src="https://travis-ci.org/ruby/rdoc.svg?branch=master" alt="Build Status on Travis CI" />}[https://travis-ci.org/ruby/rdoc] {<img src="https://ci.appveyor.com/api/projects/status/github/ruby/rdoc?branch=master&svg=true" alt="Build Status on AppVeyor" />}[https://ci.appveyor.com/project/ruby/rdoc]
code quality :: {<img src="https://codeclimate.com/github/ruby/rdoc/badges/gpa.svg" alt="Code Climate">}[https://codeclimate.com/github/ruby/rdoc]

== Description
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/markup/formatter_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
require 'test-unit'
require 'test/unit'

##
# Test case for creating new RDoc::Markup formatters. See
Expand Down
8 changes: 2 additions & 6 deletions test/rdoc/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
# for ruby tests
end

require 'test-unit'
# require 'minitest/benchmark' unless ENV['NOBENCHMARK']
require 'test/unit'

require 'fileutils'
require 'pp'
Expand Down Expand Up @@ -191,7 +190,7 @@ def verb *parts
##
# run capture_io with setting $VERBOSE = true

def verbose_capture_io
def verbose_capture_output
capture_output do
begin
orig_verbose = $VERBOSE
Expand All @@ -202,7 +201,4 @@ def verbose_capture_io
end
end
end

alias capture_io capture_output
alias skip omit
end
4 changes: 2 additions & 2 deletions test/rdoc/test_rdoc_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def test_add_method_duplicate
meth2.record_location @store.add_file 'second.rb'
meth2.comment = comment 'second'

_, err = verbose_capture_io do
_, err = verbose_capture_output do
@context.add_method meth2
end

Expand Down Expand Up @@ -260,7 +260,7 @@ def test_add_method_duplicate_loading
meth2.record_location @store.add_file 'second.rb'
meth2.comment = comment 'second'

_, err = verbose_capture_io do
_, err = verbose_capture_output do
@context.add_method meth2
end

Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/test_rdoc_context_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_remove_comment_document
end

def test_sequence
_, err = verbose_capture_io do
_, err = verbose_capture_output do
assert_match(/\ASEC\d{5}\Z/, @s.sequence)
end

Expand Down
4 changes: 2 additions & 2 deletions test/rdoc/test_rdoc_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_class_read_file_encoding_fail

contents = :junk

_, err = verbose_capture_io do
_, err = verbose_capture_output do
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII
end

Expand Down Expand Up @@ -97,7 +97,7 @@ def test_class_read_file_encoding_invalid
@tempfile.flush

contents = :junk
_, err = verbose_capture_io do
_, err = verbose_capture_output do
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
end

Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/test_rdoc_generator_json_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_generate_gzipped
begin
require 'zlib'
rescue LoadError
skip "no zlib"
omit "no zlib"
end
@g.generate
@g.generate_gzipped
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/test_rdoc_i18n_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_load_existent_po
begin
require 'gettext/po_parser'
rescue LoadError
skip 'gettext gem is not found'
omit 'gettext gem is not found'
end

fr_locale_dir = File.join @locale_dir, 'fr'
Expand Down
2 changes: 1 addition & 1 deletion test/rdoc/test_rdoc_markup_pre_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_include_file_encoding_incompatible

def test_include_file_in_other_directory
content = nil
out, err = capture_io do
out, err = capture_output do
content = @pp.include_file "test.txt", '', nil
end

Expand Down
64 changes: 32 additions & 32 deletions test/rdoc/test_rdoc_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def teardown
end

def test_check_files
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
skip "assumes that euid is not root" if Process.euid == 0
omit "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
omit "assumes that euid is not root" if Process.euid == 0

out, err = capture_io do
out, err = capture_output do
temp_dir do
FileUtils.touch 'unreadable'
FileUtils.chmod 0, 'unreadable'
Expand All @@ -40,7 +40,7 @@ def test_check_files
def test_check_files_warn
@options.verbosity = 2

out, err = verbose_capture_io do
out, err = verbose_capture_output do
@options.files = %w[nonexistent]

@options.check_files
Expand Down Expand Up @@ -218,7 +218,7 @@ def test_parse_coverage_level_1
end

def test_parse_dash_p
out, err = capture_io do
out, err = capture_output do
@options.parse %w[-p]
end

Expand All @@ -230,7 +230,7 @@ def test_parse_dash_p
end

def test_parse_dash_p_files
out, err = capture_io do
out, err = capture_output do
@options.parse ['-p', File.expand_path(__FILE__)]
end

Expand All @@ -253,7 +253,7 @@ def test_parse_deprecated
dep_hash = RDoc::Options::DEPRECATED
options = dep_hash.keys.sort

out, err = capture_io do
out, err = capture_output do
@options.parse options
end

Expand All @@ -278,7 +278,7 @@ def test_parse_encoding
end

def test_parse_encoding_invalid
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--encoding invalid]
end

Expand Down Expand Up @@ -333,7 +333,7 @@ def test_parse_formatter_ri_site
end

def test_parse_h
out, = capture_io do
out, = capture_output do
begin
@options.parse %w[-h]
rescue SystemExit
Expand All @@ -345,7 +345,7 @@ def test_parse_h
end

def test_parse_help
out, = capture_io do
out, = capture_output do
begin
@options.parse %w[--help]
rescue SystemExit
Expand All @@ -365,7 +365,7 @@ def self.setup_options options
end
end

out, = capture_io do
out, = capture_output do
begin
@options.parse %w[--help]
rescue SystemExit
Expand All @@ -392,7 +392,7 @@ def self.setup_options options
end

def test_parse_ignore_invalid
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--ignore-invalid --bogus]
end

Expand All @@ -403,7 +403,7 @@ def test_parse_ignore_invalid
end

def test_parse_ignore_invalid_default
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--bogus --main BLAH]
end

Expand All @@ -416,7 +416,7 @@ def test_parse_ignore_invalid_default
end

def test_parse_ignore_invalid_no
out, err = capture_io do
out, err = capture_output do
assert_raises SystemExit do
@options.parse %w[--no-ignore-invalid --bogus=arg --bobogus --visibility=extended]
end
Expand All @@ -429,7 +429,7 @@ def test_parse_ignore_invalid_no
end

def test_parse_ignore_invalid_no_quiet
out, err = capture_io do
out, err = capture_output do
assert_raises SystemExit do
@options.parse %w[--quiet --no-ignore-invalid --bogus=arg --bobogus --visibility=extended]
end
Expand All @@ -442,7 +442,7 @@ def test_parse_ignore_invalid_no_quiet
end

def test_ignore_needless_arg
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--ri=foo]
end

Expand All @@ -452,7 +452,7 @@ def test_ignore_needless_arg
end

def test_ignore_missing_arg
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--copy-files]
end

Expand All @@ -462,7 +462,7 @@ def test_ignore_missing_arg
end

def test_parse_main
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--main MAIN]
end

Expand All @@ -473,7 +473,7 @@ def test_parse_main
end

def test_parse_markup
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--markup tomdoc]
end

Expand All @@ -486,7 +486,7 @@ def test_parse_markup
def test_parse_page_dir
assert_nil @options.page_dir

out, err = capture_io do
out, err = capture_output do
@options.parse %W[--page-dir #{Dir.tmpdir}]
end

Expand All @@ -508,7 +508,7 @@ def test_parse_page_dir_root
abs_page_dir = File.join dir, 'pages'
FileUtils.mkdir abs_page_dir

out, err = capture_io do
out, err = capture_output do
@options.parse %W[--page-dir #{abs_page_dir} --root #{abs_root}]
end

Expand All @@ -530,7 +530,7 @@ def test_parse_ri_site
def test_parse_root
assert_equal Pathname(Dir.pwd), @options.root

out, err = capture_io do
out, err = capture_output do
@options.parse %W[--root #{Dir.tmpdir}]
end

Expand All @@ -548,21 +548,21 @@ def test_parse_tab_width
@options.parse %w[-w2]
assert_equal 2, @options.tab_width

_, err = capture_io do
_, err = capture_output do
@options.parse %w[-w=2]
end

assert_match 'invalid options', err

_, err = capture_io do
_, err = capture_output do
@options.parse %w[-w0]
end

assert_match 'invalid options', err
end

def test_parse_template
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--template darkfish]
end

Expand All @@ -575,7 +575,7 @@ def test_parse_template
end

def test_parse_template_nonexistent
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--template NONEXISTENT]
end

Expand All @@ -598,7 +598,7 @@ def test_parse_template_load_path

FileUtils.mkdir_p template_dir

out, err = capture_io do
out, err = capture_output do
@options.parse %w[--template load_path]
end

Expand Down Expand Up @@ -644,7 +644,7 @@ def test_parse_write_options
end

def test_parse_extension_alias
out, err = capture_io do
out, err = capture_output do
@options.parse %w[--extension foobar=rdoc]
end

Expand Down Expand Up @@ -706,7 +706,7 @@ def test_update_output_dir
end

def test_warn
out, err = capture_io do
out, err = capture_output do
@options.warn "warnings off"
end

Expand All @@ -715,7 +715,7 @@ def test_warn

@options.verbosity = 2

out, err = verbose_capture_io do
out, err = verbose_capture_output do
@options.warn "warnings on"
end

Expand All @@ -734,7 +734,7 @@ def test_write_options
end

def test_version
out, _ = capture_io do
out, _ = capture_output do
begin
@options.parse %w[--version]
rescue SystemExit
Expand All @@ -743,7 +743,7 @@ def test_version

assert out.include?(RDoc::VERSION)

out, _ = capture_io do
out, _ = capture_output do
begin
@options.parse %w[-v]
rescue SystemExit
Expand Down
Loading