Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ported 37978 from trunk

Added verbose_capture_io for tests when run with RUBYOPT=-W0
  • Loading branch information...
commit 3e6dadba7d743931358da7f5f8d3ff9dac8b8c4c 1 parent c2ac963
@drbrain drbrain authored
View
14 lib/rdoc/test_case.rb
@@ -153,6 +153,20 @@ def verb *parts
@RM::Verbatim.new(*parts)
end
+ ##
+ # run capture_io with setting $VERBOSE = true
+
+ def verbose_capture_io
+ capture_io do
+ begin
+ orig_verbose = $VERBOSE
+ $VERBOSE = true
+ yield
+ ensure
+ $VERBOSE = orig_verbose
+ end
+ end
+ end
end
# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since
View
2  test/test_rdoc_context.rb
@@ -230,7 +230,7 @@ def test_add_method_duplicate
meth2.record_location @store.add_file 'second.rb'
meth2.comment = comment 'second'
- _, err = capture_io do
+ _, err = verbose_capture_io do
@context.add_method meth2
end
View
2  test/test_rdoc_context_section.rb
@@ -126,7 +126,7 @@ def test_remove_comment_document
end
def test_sequence
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert_match(/\ASEC\d{5}\Z/, @s.sequence)
end
View
4 test/test_rdoc_encoding.rb
@@ -53,7 +53,7 @@ def test_class_read_file_encoding_fail
contents = :junk
- _, err = capture_io do
+ _, err = verbose_capture_io do
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII
end
@@ -104,7 +104,7 @@ def test_class_read_file_encoding_invalid
@tempfile.flush
contents = :junk
- _, err = capture_io do
+ _, err = verbose_capture_io do
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
end
View
4 test/test_rdoc_options.rb
@@ -45,7 +45,7 @@ def test_check_files
def test_check_files_warn
@options.verbosity = 2
- out, err = capture_io do
+ out, err = verbose_capture_io do
@options.files = %w[nonexistent]
@options.check_files
@@ -572,7 +572,7 @@ def test_warn
@options.verbosity = 2
- out, err = capture_io do
+ out, err = verbose_capture_io do
@options.warn "warnings on"
end
View
10 test/test_rdoc_parser_c.rb
@@ -244,7 +244,7 @@ def test_do_aliases_missing_class
}
EOF
- _, err = capture_io do
+ _, err = verbose_capture_io do
refute util_get_class(content, 'cDate')
end
@@ -549,7 +549,7 @@ def test_do_methods_in_c
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -571,7 +571,7 @@ def test_do_methods_in_cpp
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -593,7 +593,7 @@ def test_do_methods_in_y
klass = nil
- _, err = capture_io do
+ _, err = verbose_capture_io do
klass = util_get_class content, 'cDate'
end
@@ -659,7 +659,7 @@ def test_do_missing_cycle
parser.missing_dependencies['y'] = ['y', :class, 'Y', 'Object', 'z']
parser.missing_dependencies['z'] = ['z', :class, 'Z', 'Object', 'y']
- _, err = capture_io do
+ _, err = verbose_capture_io do
parser.do_missing
end
View
2  test/test_rdoc_rdoc.rb
@@ -128,7 +128,7 @@ def test_normalized_file_list_non_file_directory
files = nil
- out, err = capture_io do
+ out, err = verbose_capture_io do
files = @rdoc.normalized_file_list %w[/dev/stdin]
end
View
4 test/test_rdoc_task.rb
@@ -16,13 +16,13 @@ def test_clobber_task_description
end
def test_inline_source
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert @t.inline_source
end
assert_equal "RDoc::Task#inline_source is deprecated\n", err
- _, err = capture_io do
+ _, err = verbose_capture_io do
@t.inline_source = false
end
View
2  test/test_rdoc_text.rb
@@ -553,7 +553,7 @@ def test_to_html_tt_tag
end
def test_to_html_tt_tag_mismatch
- _, err = capture_io do
+ _, err = verbose_capture_io do
assert_equal '<tt>hi', to_html('<tt>hi')
end
Please sign in to comment.
Something went wrong with that request. Please try again.