1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RDoc 2.2.2 r192

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-10-24 23:05:28 +00:00
parent da6300e8f8
commit 7222e82a8b
22 changed files with 115 additions and 54 deletions

View file

@ -1,3 +1,7 @@
Sat Oct 25 07:42:49 2008 Eric Hodel <drbrain@segment7.net>
* lib/rdoc*: Update to RDoc 2.2.2 r192.
Sat Oct 25 04:00:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Oct 25 04:00:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enc/us_ascii.c (us_ascii_mbc_enc_len): made static. a patch by * enc/us_ascii.c (us_ascii_mbc_enc_len): made static. a patch by

View file

@ -372,7 +372,7 @@ module RDoc
## ##
# RDoc version you are using # RDoc version you are using
VERSION = "2.2.1" VERSION = "2.2.2"
## ##
# Name of the dotfile that contains the description of files to be processed # Name of the dotfile that contains the description of files to be processed

View file

@ -68,7 +68,12 @@ class RDoc::Parser
def self.binary?(file) def self.binary?(file)
s = (File.read(file, File.stat(file).blksize) || "").split(//) s = (File.read(file, File.stat(file).blksize) || "").split(//)
if s.size > 0 then
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30 ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
else
false
end
end end
private_class_method :binary? private_class_method :binary?
@ -106,6 +111,13 @@ class RDoc::Parser
parser = can_parse file_name parser = can_parse file_name
#
# This method must return a parser.
#
if !parser then
parser = RDoc::Parser::Simple
end
parser.new top_level, file_name, body, options, stats parser.new top_level, file_name, body, options, stats
end end

View file

@ -1,4 +1,5 @@
require 'rdoc/parser' require 'rdoc/parser'
require 'rdoc/parser/ruby'
require 'rdoc/known_classes' require 'rdoc/known_classes'
## ##

View file

@ -5,8 +5,8 @@ require 'rdoc/ri'
begin begin
require('readline') require('readline')
require('abbrev') require('abbrev')
CAN_USE_READLINE = true CAN_USE_READLINE = true # HACK use an RDoc namespace constant
rescue rescue LoadError
CAN_USE_READLINE = false CAN_USE_READLINE = false
end end
@ -53,7 +53,7 @@ class RDoc::RI::DefaultDisplay
def display_class_info(klass) def display_class_info(klass)
page do page do
superclass = klass.superclass_string superclass = klass.superclass
if superclass if superclass
superclass = " < " + superclass superclass = " < " + superclass
@ -217,7 +217,7 @@ class RDoc::RI::DefaultDisplay
end end
method_names.sort! method_names.sort!
@formatter.wrap method_names.join(',') @formatter.wrap method_names.join(', ')
end end
end end
@ -390,4 +390,3 @@ class RDoc::RI::DefaultDisplay
end end
end end

View file

@ -28,15 +28,13 @@ module RDoc::RI::Paths
VERSION = RbConfig::CONFIG['ruby_version'] VERSION = RbConfig::CONFIG['ruby_version']
ri = RbConfig::CONFIG['RUBY_INSTALL_NAME'].sub(/ruby/, 'ri') base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION)
base = File.join(RbConfig::CONFIG['datadir'], ri, VERSION)
SYSDIR = File.join(base, "system") SYSDIR = File.join(base, "system")
SITEDIR = File.join(base, "site") SITEDIR = File.join(base, "site")
homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']
if homedir then if homedir then
rdoc = RbConfig::CONFIG['RUBY_INSTALL_NAME'].sub(/ruby/, 'rdoc') HOMEDIR = File.join(homedir, ".rdoc")
HOMEDIR = File.join(homedir, ".#{rdoc}")
else else
HOMEDIR = nil HOMEDIR = nil
end end

View file

@ -1,7 +1,8 @@
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/markup/attribute_manager' require 'rdoc/markup/attribute_manager'
class TestAttributeManager < Test::Unit::TestCase class TestAttributeManager < MiniTest::Unit::TestCase
def setup def setup
@am = RDoc::Markup::AttributeManager.new @am = RDoc::Markup::AttributeManager.new
@ -36,7 +37,7 @@ class TestAttributeManager < Test::Unit::TestCase
end end
def test_add_invalid_word_pair def test_add_invalid_word_pair
assert_raise ArgumentError do assert_raises ArgumentError do
@am.add_word_pair("<", "<", :TEST) @am.add_word_pair("<", "<", :TEST)
end end
end end
@ -71,3 +72,5 @@ class TestAttributeManager < Test::Unit::TestCase
end end
end end
MiniTest::Unit.autorun

View file

@ -1,11 +1,12 @@
require 'fileutils' require 'fileutils'
require 'tmpdir' require 'tmpdir'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/generator/texinfo' require 'rdoc/generator/texinfo'
# From chapter 18 of the Pickaxe 3rd ed. and the TexInfo manual. # From chapter 18 of the Pickaxe 3rd ed. and the TexInfo manual.
class TestRDocInfoFormatting < Test::Unit::TestCase class TestRDocInfoFormatting < MiniTest::Unit::TestCase
def setup def setup
@output_dir = File.join Dir.tmpdir, "test_rdoc_info_formatting_#{$$}" @output_dir = File.join Dir.tmpdir, "test_rdoc_info_formatting_#{$$}"
@output_file = File.join @output_dir, 'rdoc.texinfo' @output_file = File.join @output_dir, 'rdoc.texinfo'
@ -19,12 +20,13 @@ class TestRDocInfoFormatting < Test::Unit::TestCase
end end
def teardown def teardown
FileUtils.rm_rf @output_dir # FileUtils.rm_rf @output_dir
end end
# Make sure tags like *this* do not make HTML # Make sure tags like *this* do not make HTML
def test_descriptions_are_not_html def test_descriptions_are_not_html
assert_no_match Regexp.new("\<b\>this\<\/b\>"), @text, "We had some HTML; icky!" refute_match Regexp.new("\<b\>this\<\/b\>"), @text,
"We had some HTML; icky!"
end end
# Ensure we get a reasonable amount # Ensure we get a reasonable amount
@ -173,3 +175,5 @@ Second outer item.
assert string[regex] #, message assert string[regex] #, message
end end
end end
MiniTest::Unit.autorun

View file

@ -1,6 +1,7 @@
require 'fileutils' require 'fileutils'
require 'tempfile' require 'tempfile'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'tmpdir' require 'tmpdir'
require 'rdoc/generator/texinfo' require 'rdoc/generator/texinfo'
@ -9,7 +10,7 @@ require 'rdoc/generator/texinfo'
class RDoc::Generator::TEXINFO; attr_reader :files, :classes; end class RDoc::Generator::TEXINFO; attr_reader :files, :classes; end
class RDoc::RDoc; attr_reader :options; attr_reader :gen; end class RDoc::RDoc; attr_reader :options; attr_reader :gen; end
class TestRDocInfoSections < Test::Unit::TestCase class TestRDocInfoSections < MiniTest::Unit::TestCase
def setup def setup
@output_dir = File.join Dir.tmpdir, "test_rdoc_info_sections_#{$$}" @output_dir = File.join Dir.tmpdir, "test_rdoc_info_sections_#{$$}"
@ -134,3 +135,5 @@ end
DOC DOC
end end
MiniTest::Unit.autorun

View file

@ -1,8 +1,9 @@
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/markup' require 'rdoc/markup'
require 'rdoc/markup/to_test' require 'rdoc/markup/to_test'
class TestRDocMarkup < Test::Unit::TestCase class TestRDocMarkup < MiniTest::Unit::TestCase
def basic_conv(str) def basic_conv(str)
sm = RDoc::Markup.new sm = RDoc::Markup.new
@ -611,3 +612,4 @@ class TestRDocMarkup < Test::Unit::TestCase
end end
MiniTest::Unit.autorun

View file

@ -1,8 +1,9 @@
require "test/unit" require "rubygems"
require "minitest/unit"
require "rdoc/markup/inline" require "rdoc/markup/inline"
require "rdoc/markup/to_html_crossref" require "rdoc/markup/to_html_crossref"
class TestRDocMarkupAttributeManager < Test::Unit::TestCase class TestRDocMarkupAttributeManager < MiniTest::Unit::TestCase
def setup def setup
@orig_special = RDoc::Markup::AttributeManager::SPECIAL @orig_special = RDoc::Markup::AttributeManager::SPECIAL
@ -60,7 +61,7 @@ class TestRDocMarkupAttributeManager < Test::Unit::TestCase
end end
def test_add_word_pair_angle def test_add_word_pair_angle
e = assert_raise ArgumentError do e = assert_raises ArgumentError do
@am.add_word_pair '<', '>', 'angles' @am.add_word_pair '<', '>', 'angles'
end end
@ -229,3 +230,5 @@ class TestRDocMarkupAttributeManager < Test::Unit::TestCase
end end
end end
MiniTest::Unit.autorun

View file

@ -1,8 +1,9 @@
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/markup' require 'rdoc/markup'
require 'rdoc/markup/to_html' require 'rdoc/markup/to_html'
class TestRDocMarkupToHtml < Test::Unit::TestCase class TestRDocMarkupToHtml < MiniTest::Unit::TestCase
def setup def setup
@am = RDoc::Markup::AttributeManager.new @am = RDoc::Markup::AttributeManager.new
@ -40,3 +41,5 @@ class TestRDocMarkupToHtml < Test::Unit::TestCase
end end
end end
MiniTest::Unit.autorun

View file

@ -1,10 +1,14 @@
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/generator' require 'rdoc/generator'
require 'rdoc/stats'
require 'rdoc/code_objects'
require 'rdoc/markup/to_html_crossref' require 'rdoc/markup/to_html_crossref'
require 'rdoc/parser/ruby'
require 'pathname' require 'pathname'
class TestRDocMarkupToHtmlCrossref < Test::Unit::TestCase class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
# #
# This method parses a source file and returns a Hash mapping # This method parses a source file and returns a Hash mapping
@ -286,3 +290,5 @@ class TestRDocMarkupToHtmlCrossref < Test::Unit::TestCase
verify_class_crossref xref, "Ref_Class4", "Ref_Class4::Ref_Class4" verify_class_crossref xref, "Ref_Class4", "Ref_Class4::Ref_Class4"
end end
end end
MiniTest::Unit.autorun

View file

@ -1,12 +1,15 @@
require 'rubygems'
require 'minitest/unit'
require 'rdoc/parser' require 'rdoc/parser'
require 'rdoc/parser/ruby'
class TestRDocParser < Test::Unit::TestCase class TestRDocParser < MiniTest::Unit::TestCase
def test_can_parse def test_can_parse
assert_equal(RDoc::Parser.can_parse(__FILE__), RDoc::Parser::Ruby) assert_equal(RDoc::Parser.can_parse(__FILE__), RDoc::Parser::Ruby)
readme_file_name = File.join(File.dirname(__FILE__), "..", "README.txt") readme_file_name = File.join(File.dirname(__FILE__), "..", "README.txt")
unless File.exist? readme_file_name then unless File.exist? readme_file_name then # HACK for tests in trunk :/
readme_file_name = File.join File.dirname(__FILE__), '..', '..', 'README' readme_file_name = File.join File.dirname(__FILE__), '..', '..', 'README'
end end
@ -16,3 +19,5 @@ class TestRDocParser < Test::Unit::TestCase
assert_equal(RDoc::Parser.can_parse(binary_file_name), nil) assert_equal(RDoc::Parser.can_parse(binary_file_name), nil)
end end
end end
MiniTest::Unit.autorun

View file

@ -1,6 +1,7 @@
require 'stringio' require 'stringio'
require 'tempfile' require 'tempfile'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/options' require 'rdoc/options'
require 'rdoc/parser/c' require 'rdoc/parser/c'
@ -10,7 +11,7 @@ class RDoc::Parser::C
public :do_classes, :do_constants public :do_classes, :do_constants
end end
class TestRDocParserC < Test::Unit::TestCase class TestRDocParserC < MiniTest::Unit::TestCase
def setup def setup
@tempfile = Tempfile.new self.class.name @tempfile = Tempfile.new self.class.name
@ -283,3 +284,4 @@ Init_IO(void) {
end end
MiniTest::Unit.autorun

View file

@ -1,10 +1,11 @@
require 'stringio' require 'stringio'
require 'tempfile' require 'tempfile'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/options' require 'rdoc/options'
require 'rdoc/parser/perl' require 'rdoc/parser/perl'
class TestRdocParserPerlPOD < Test::Unit::TestCase class TestRdocParserPerlPOD < MiniTest::Unit::TestCase
def setup def setup
@tempfile = Tempfile.new self.class.name @tempfile = Tempfile.new self.class.name
@ -70,3 +71,4 @@ This just contains plain old documentation
end end
MiniTest::Unit.autorun

View file

@ -1,12 +1,13 @@
require 'stringio' require 'stringio'
require 'tempfile' require 'tempfile'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/options' require 'rdoc/options'
require 'rdoc/parser/ruby' require 'rdoc/parser/ruby'
require 'rdoc/stats' require 'rdoc/stats'
class TestRDocParserRuby < Test::Unit::TestCase class TestRDocParserRuby < MiniTest::Unit::TestCase
def setup def setup
@tempfile = Tempfile.new self.class.name @tempfile = Tempfile.new self.class.name
@ -747,3 +748,4 @@ EOF
end end
MiniTest::Unit.autorun

View file

@ -1,8 +1,9 @@
require 'stringio' require 'stringio'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/ri/formatter' require 'rdoc/ri/formatter'
class TestRDocRIAttributeFormatter < Test::Unit::TestCase class TestRDocRIAttributeFormatter < MiniTest::Unit::TestCase
def setup def setup
@output = StringIO.new @output = StringIO.new
@ -40,3 +41,4 @@ class TestRDocRIAttributeFormatter < Test::Unit::TestCase
end end
MiniTest::Unit.autorun

View file

@ -1,10 +1,11 @@
require 'stringio' require 'stringio'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/ri/formatter' require 'rdoc/ri/formatter'
require 'rdoc/ri/display' require 'rdoc/ri/display'
require 'rdoc/ri/driver' require 'rdoc/ri/driver'
class TestRDocRiDefaultDisplay < Test::Unit::TestCase class TestRDocRiDefaultDisplay < MiniTest::Unit::TestCase
def setup def setup
@output = StringIO.new @output = StringIO.new
@ -52,11 +53,12 @@ class TestRDocRiDefaultDisplay < Test::Unit::TestCase
'includes' => [], 'includes' => [],
'instance_methods' => [ 'instance_methods' => [
{ 'name' => 'instance_method' }, { 'name' => 'instance_method' },
{ 'name' => 'instance_method2' },
], ],
'instance_method_extensions' => [ 'instance_method_extensions' => [
{ 'name' => 'instance_method_extension' }, { 'name' => 'instance_method_extension' },
], ],
'superclass_string' => 'Object' 'superclass' => 'Object'
@dd.display_class_info klass @dd.display_class_info klass
@ -100,7 +102,7 @@ Class method extensions:
Instance methods: Instance methods:
----------------- -----------------
instance_method instance_method, instance_method2
Instance method extensions: Instance method extensions:
@ -295,3 +297,5 @@ install an additional package, or ask the packager to enable ri generation.
end end
end end
MiniTest::Unit.autorun

View file

@ -1,8 +1,9 @@
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'tmpdir' require 'tmpdir'
require 'rdoc/ri/driver' require 'rdoc/ri/driver'
class TestRDocRIDriver < Test::Unit::TestCase class TestRDocRIDriver < MiniTest::Unit::TestCase
def setup def setup
@tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}" @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
@ -90,3 +91,4 @@ class TestRDocRIDriver < Test::Unit::TestCase
end end
MiniTest::Unit.autorun

View file

@ -1,9 +1,10 @@
require 'stringio' require 'stringio'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/ri/formatter' require 'rdoc/ri/formatter'
require 'rdoc/markup/to_flow' require 'rdoc/markup/to_flow'
class TestRDocRIFormatter < Test::Unit::TestCase class TestRDocRIFormatter < MiniTest::Unit::TestCase
def setup def setup
@output = StringIO.new @output = StringIO.new
@ -97,7 +98,7 @@ class TestRDocRIFormatter < Test::Unit::TestCase
end end
def test_display_flow_item_unknown def test_display_flow_item_unknown
e = assert_raise RDoc::Error do e = assert_raises RDoc::Error do
@f.display_flow_item Object.new @f.display_flow_item Object.new
end end
@ -189,7 +190,7 @@ class TestRDocRIFormatter < Test::Unit::TestCase
list = RDoc::Markup::Flow::LIST.new :UNKNOWN list = RDoc::Markup::Flow::LIST.new :UNKNOWN
list << RDoc::Markup::Flow::LI.new(nil, 'a b c') list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
e = assert_raise ArgumentError do e = assert_raises ArgumentError do
@f.display_list list @f.display_list list
end end
@ -316,3 +317,4 @@ class TestRDocRIFormatter < Test::Unit::TestCase
end end
MiniTest::Unit.autorun

View file

@ -1,10 +1,11 @@
require 'stringio' require 'stringio'
require 'test/unit' require 'rubygems'
require 'minitest/unit'
require 'rdoc/ri/formatter' require 'rdoc/ri/formatter'
require 'rdoc/markup/fragments' require 'rdoc/markup/fragments'
require 'rdoc/markup/to_flow' require 'rdoc/markup/to_flow'
class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase class TestRDocRIOverstrikeFormatter < MiniTest::Unit::TestCase
def setup def setup
@output = StringIO.new @output = StringIO.new
@ -67,3 +68,4 @@ class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase
end end
MiniTest::Unit.autorun