mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import RDoc 2.5.4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
37e59f5583
commit
75ef9e79d6
14 changed files with 169 additions and 77 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Apr 19 13:58:04 2010 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* lib/rdoc: Update to RDoc 2.5.4. Fixes #3169, #3160, #3023.
|
||||||
|
|
||||||
Mon Apr 19 12:46:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Apr 19 12:46:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/timeout.rb (Timeout#timeout): propagate errors to the
|
* lib/timeout.rb (Timeout#timeout): propagate errors to the
|
||||||
|
|
|
@ -383,7 +383,7 @@ module RDoc
|
||||||
##
|
##
|
||||||
# RDoc version you are using
|
# RDoc version you are using
|
||||||
|
|
||||||
VERSION = '2.5.3'
|
VERSION = '2.5.4'
|
||||||
|
|
||||||
##
|
##
|
||||||
# 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
|
||||||
|
|
|
@ -45,11 +45,6 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
|
|
||||||
attr_reader :aliases
|
attr_reader :aliases
|
||||||
|
|
||||||
##
|
|
||||||
# Fragment reference for this method
|
|
||||||
|
|
||||||
attr_reader :aref
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# The method we're aliasing
|
# The method we're aliasing
|
||||||
|
|
||||||
|
@ -67,21 +62,13 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
|
|
||||||
include RDoc::TokenStream
|
include RDoc::TokenStream
|
||||||
|
|
||||||
##
|
|
||||||
# Resets method fragment reference counter
|
|
||||||
|
|
||||||
def self.reset
|
|
||||||
@@aref = 'M000000'
|
|
||||||
end
|
|
||||||
|
|
||||||
reset
|
|
||||||
|
|
||||||
def initialize(text, name)
|
def initialize(text, name)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
@text = text
|
@text = text
|
||||||
@name = name
|
@name = name
|
||||||
|
|
||||||
|
@aref = nil
|
||||||
@aliases = []
|
@aliases = []
|
||||||
@block_params = nil
|
@block_params = nil
|
||||||
@call_seq = nil
|
@call_seq = nil
|
||||||
|
@ -92,9 +79,6 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@singleton = nil
|
@singleton = nil
|
||||||
@token_stream = nil
|
@token_stream = nil
|
||||||
@visibility = :public
|
@visibility = :public
|
||||||
|
|
||||||
@aref = @@aref
|
|
||||||
@@aref = @@aref.succ
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -111,6 +95,15 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
@aliases << method
|
@aliases << method
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# HTML fragment reference for this method
|
||||||
|
|
||||||
|
def aref
|
||||||
|
type = singleton ? 'c' : 'i'
|
||||||
|
|
||||||
|
"method-#{type}-#{CGI.escape name}"
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# The call_seq or the param_seq with method name, if there is no call_seq.
|
# The call_seq or the param_seq with method name, if there is no call_seq.
|
||||||
#
|
#
|
||||||
|
@ -248,7 +241,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
|
||||||
# Path to this method
|
# Path to this method
|
||||||
|
|
||||||
def path
|
def path
|
||||||
"#{@parent.path}##{@aref}"
|
"#{@parent.path}##{aref}"
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -6,6 +6,24 @@ require 'rdoc/text'
|
||||||
#
|
#
|
||||||
# We contain the common stuff for contexts (which are containers) and other
|
# We contain the common stuff for contexts (which are containers) and other
|
||||||
# elements (methods, attributes and so on)
|
# elements (methods, attributes and so on)
|
||||||
|
#
|
||||||
|
# Here's the tree of the CodeObject subclasses:
|
||||||
|
#
|
||||||
|
# * RDoc::Context
|
||||||
|
# * RDoc::TopLevel
|
||||||
|
# * RDoc::ClassModule
|
||||||
|
# * RDoc::AnonClass
|
||||||
|
# * RDoc::NormalClass
|
||||||
|
# * RDoc::NormalModule
|
||||||
|
# * RDoc::SingleClass
|
||||||
|
# * RDoc::AnyMethod
|
||||||
|
# * RDoc::GhostMethod
|
||||||
|
# * RDoc::MetaMethod
|
||||||
|
# * RDoc::Alias
|
||||||
|
# * RDoc::Attr
|
||||||
|
# * RDoc::Constant
|
||||||
|
# * RDoc::Require
|
||||||
|
# * RDoc::Include
|
||||||
|
|
||||||
class RDoc::CodeObject
|
class RDoc::CodeObject
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,13 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
@attributes.find { |m| m.name == name }
|
@attributes.find { |m| m.name == name }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Finds a class method with +name+ in this context
|
||||||
|
|
||||||
|
def find_class_method_named(name)
|
||||||
|
@method_list.find { |meth| meth.singleton && meth.name == name }
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Finds a constant with +name+ in this context
|
# Finds a constant with +name+ in this context
|
||||||
|
|
||||||
|
@ -535,7 +542,7 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
# Finds an instance method with +name+ in this context
|
# Finds an instance method with +name+ in this context
|
||||||
|
|
||||||
def find_instance_method_named(name)
|
def find_instance_method_named(name)
|
||||||
@method_list.find { |meth| meth.name == name && !meth.singleton }
|
@method_list.find { |meth| !meth.singleton && meth.name == name }
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -554,7 +561,14 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
# Finds a instance or module method with +name+ in this context
|
# Finds a instance or module method with +name+ in this context
|
||||||
|
|
||||||
def find_method_named(name)
|
def find_method_named(name)
|
||||||
@method_list.find { |meth| meth.name == name }
|
case name
|
||||||
|
when /\A#/ then
|
||||||
|
find_instance_method_named name[1..-1]
|
||||||
|
when /\A::/ then
|
||||||
|
find_class_method_named name[2..-1]
|
||||||
|
else
|
||||||
|
@method_list.find { |meth| meth.name == name }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -575,7 +589,7 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
result = nil
|
result = nil
|
||||||
|
|
||||||
case symbol
|
case symbol
|
||||||
when /^::(.*)/ then
|
when /^::([A-Z].*)/ then
|
||||||
result = top_level.find_symbol($1)
|
result = top_level.find_symbol($1)
|
||||||
when /::/ then
|
when /::/ then
|
||||||
modules = symbol.split(/::/)
|
modules = symbol.split(/::/)
|
||||||
|
@ -591,8 +605,9 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
else
|
unless result then
|
||||||
# if a method is specified, then we're definitely looking for
|
# if a method is specified, then we're definitely looking for
|
||||||
# a module, otherwise it could be any symbol
|
# a module, otherwise it could be any symbol
|
||||||
if method then
|
if method then
|
||||||
|
@ -610,10 +625,7 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if result and method then
|
result = result.find_local_symbol method if result and method
|
||||||
fail unless result.respond_to? :find_local_symbol
|
|
||||||
result = result.find_local_symbol(method)
|
|
||||||
end
|
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
#
|
#
|
||||||
# See CLASS_REGEXP_STR
|
# See CLASS_REGEXP_STR
|
||||||
|
|
||||||
METHOD_REGEXP_STR = '(\w+[!?=]?)(?:\([\w.+*/=<>-]*\))?'
|
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?)(?:\([\w.+*/=<>-]*\))?'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Regular expressions matching text that should potentially have
|
# Regular expressions matching text that should potentially have
|
||||||
|
@ -32,11 +32,14 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
|
|
||||||
CROSSREF_REGEXP = /(
|
CROSSREF_REGEXP = /(
|
||||||
# A::B::C.meth
|
# A::B::C.meth
|
||||||
#{CLASS_REGEXP_STR}[\.\#]#{METHOD_REGEXP_STR}
|
#{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
|
||||||
|
|
||||||
# Stand-alone method (proceeded by a #)
|
# Stand-alone method (proceeded by a #)
|
||||||
| \\?\##{METHOD_REGEXP_STR}
|
| \\?\##{METHOD_REGEXP_STR}
|
||||||
|
|
||||||
|
# Stand-alone method (proceeded by ::)
|
||||||
|
| ::#{METHOD_REGEXP_STR}
|
||||||
|
|
||||||
# A::B::C
|
# A::B::C
|
||||||
# The stuff after CLASS_REGEXP_STR is a
|
# The stuff after CLASS_REGEXP_STR is a
|
||||||
# nasty hack. CLASS_REGEXP_STR unfortunately matches
|
# nasty hack. CLASS_REGEXP_STR unfortunately matches
|
||||||
|
@ -86,11 +89,11 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# We're invoked when any text matches the CROSSREF pattern (defined in
|
# We're invoked when any text matches the CROSSREF pattern. If we find the
|
||||||
# MarkUp). If we find the corresponding reference, generate a hyperlink.
|
# corresponding reference, generate a hyperlink. If the name we're looking
|
||||||
# If the name we're looking for contains no punctuation, we look for it up
|
# for contains no punctuation, we look for it up the module/class chain.
|
||||||
# the module/class chain. For example, HyperlinkHtml is found, even without
|
# For example, HyperlinkHtml is found, even without the Generator:: prefix,
|
||||||
# the Generator:: prefix, because we look for it in module Generator first.
|
# because we look for it in module Generator first.
|
||||||
|
|
||||||
def handle_special_CROSSREF(special)
|
def handle_special_CROSSREF(special)
|
||||||
name = special.text
|
name = special.text
|
||||||
|
@ -102,12 +105,9 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
|
|
||||||
return @seen[name] if @seen.include? name
|
return @seen[name] if @seen.include? name
|
||||||
|
|
||||||
if name[0, 1] == '#' then
|
lookup = name
|
||||||
lookup = name[1..-1]
|
|
||||||
name = lookup unless @show_hash
|
name = name[0, 1] unless @show_hash if name[0, 1] == '#'
|
||||||
else
|
|
||||||
lookup = name
|
|
||||||
end
|
|
||||||
|
|
||||||
# Find class, module, or method in class or module.
|
# Find class, module, or method in class or module.
|
||||||
#
|
#
|
||||||
|
@ -119,9 +119,11 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
# (in which case it would match the last pattern, which just checks
|
# (in which case it would match the last pattern, which just checks
|
||||||
# whether the string as a whole is a known symbol).
|
# whether the string as a whole is a known symbol).
|
||||||
|
|
||||||
if /#{CLASS_REGEXP_STR}[\.\#]#{METHOD_REGEXP_STR}/ =~ lookup then
|
if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/ =~ lookup then
|
||||||
container = $1
|
container = $1
|
||||||
method = $2
|
type = $2
|
||||||
|
type = '#' if type == '.'
|
||||||
|
method = "#{type}#{$3}"
|
||||||
ref = @context.find_symbol container, method
|
ref = @context.find_symbol container, method
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -132,7 +134,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
||||||
elsif lookup =~ /^\\/ then
|
elsif lookup =~ /^\\/ then
|
||||||
$'
|
$'
|
||||||
elsif ref and ref.document_self then
|
elsif ref and ref.document_self then
|
||||||
"<a href=\"#{ref.as_href(@from_path)}\">#{name}</a>"
|
"<a href=\"#{ref.as_href @from_path}\">#{name}</a>"
|
||||||
else
|
else
|
||||||
name
|
name
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,8 +75,10 @@ class RDoc::Parser
|
||||||
false
|
false
|
||||||
elsif s.scan(/<%|%>/).length >= 4 || s.index("\x00") then
|
elsif s.scan(/<%|%>/).length >= 4 || s.index("\x00") then
|
||||||
true
|
true
|
||||||
else
|
elsif 0.respond_to? :fdiv then
|
||||||
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
|
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
|
||||||
|
else # HACK 1.8.6
|
||||||
|
(s.count("^ -~\t\r\n").to_f / s.size) > 0.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1524,24 +1524,29 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
skip_tkspace false
|
skip_tkspace false
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
case tk
|
case tk
|
||||||
when TkLPAREN, TkfLPAREN
|
when TkLPAREN, TkfLPAREN then
|
||||||
end_token = TkRPAREN
|
end_token = TkRPAREN
|
||||||
else
|
else
|
||||||
end_token = TkNL
|
end_token = TkNL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
b_nest = 0
|
||||||
nest = 0
|
nest = 0
|
||||||
@scanner.instance_eval{@continue = false}
|
@scanner.instance_eval { @continue = false }
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
case tk
|
case tk
|
||||||
when TkSEMICOLON
|
when TkSEMICOLON then
|
||||||
break
|
break if b_nest.zero?
|
||||||
when TkLPAREN, TkfLPAREN
|
when TkLPAREN, TkfLPAREN then
|
||||||
nest += 1
|
nest += 1
|
||||||
|
when TkBEGIN then
|
||||||
|
b_nest += 1
|
||||||
|
when TkEND then
|
||||||
|
b_nest -= 1
|
||||||
when TkDO
|
when TkDO
|
||||||
break if nest.zero?
|
break if nest.zero?
|
||||||
when end_token
|
when end_token then
|
||||||
if end_token == TkRPAREN
|
if end_token == TkRPAREN
|
||||||
nest -= 1
|
nest -= 1
|
||||||
break if @scanner.lex_state == EXPR_END and nest.zero?
|
break if @scanner.lex_state == EXPR_END and nest.zero?
|
||||||
|
@ -1553,6 +1558,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
end
|
end
|
||||||
tk = get_tk
|
tk = get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace false
|
||||||
|
|
||||||
get_tk if TkDO === peek_tk
|
get_tk if TkDO === peek_tk
|
||||||
|
|
|
@ -353,7 +353,6 @@ The internal error was:
|
||||||
def document(argv)
|
def document(argv)
|
||||||
RDoc::TopLevel.reset
|
RDoc::TopLevel.reset
|
||||||
RDoc::Parser::C.reset
|
RDoc::Parser::C.reset
|
||||||
RDoc::AnyMethod.reset
|
|
||||||
|
|
||||||
@options = RDoc::Options.new
|
@options = RDoc::Options.new
|
||||||
@options.parse argv
|
@options.parse argv
|
||||||
|
|
|
@ -2,6 +2,16 @@ require File.expand_path '../xref_test_case', __FILE__
|
||||||
|
|
||||||
class RDocAnyMethodTest < XrefTestCase
|
class RDocAnyMethodTest < XrefTestCase
|
||||||
|
|
||||||
|
def test_aref
|
||||||
|
m = RDoc::AnyMethod.new nil, 'method?'
|
||||||
|
|
||||||
|
assert_equal 'method-i-method%3F', m.aref
|
||||||
|
|
||||||
|
m.singleton = true
|
||||||
|
|
||||||
|
assert_equal 'method-c-method%3F', m.aref
|
||||||
|
end
|
||||||
|
|
||||||
def test_arglists
|
def test_arglists
|
||||||
m = RDoc::AnyMethod.new nil, 'method'
|
m = RDoc::AnyMethod.new nil, 'method'
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,14 @@ class TestRDocContext < XrefTestCase
|
||||||
assert_equal 'RW', @c1.find_attribute_named('attr_accessor').rw
|
assert_equal 'RW', @c1.find_attribute_named('attr_accessor').rw
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_class_method_named
|
||||||
|
assert_equal nil, @c1.find_class_method_named('none')
|
||||||
|
|
||||||
|
m = @c1.find_class_method_named('m')
|
||||||
|
assert_instance_of RDoc::AnyMethod, m
|
||||||
|
assert m.singleton
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_constant_named
|
def test_find_constant_named
|
||||||
assert_equal nil, @c1.find_constant_named('NONE')
|
assert_equal nil, @c1.find_constant_named('NONE')
|
||||||
assert_equal ':const', @c1.find_constant_named('CONST').value
|
assert_equal ':const', @c1.find_constant_named('CONST').value
|
||||||
|
@ -248,7 +256,7 @@ class TestRDocContext < XrefTestCase
|
||||||
|
|
||||||
m = @c1.find_instance_method_named('m')
|
m = @c1.find_instance_method_named('m')
|
||||||
assert_instance_of RDoc::AnyMethod, m
|
assert_instance_of RDoc::AnyMethod, m
|
||||||
assert_equal false, m.singleton
|
refute m.singleton
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_local_symbol
|
def test_find_local_symbol
|
||||||
|
@ -278,6 +286,12 @@ class TestRDocContext < XrefTestCase
|
||||||
assert_equal @c2_c3, @c2.find_symbol('C3')
|
assert_equal @c2_c3, @c2.find_symbol('C3')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_symbol_method
|
||||||
|
assert_equal @c1__m, @c1.find_symbol('m')
|
||||||
|
assert_equal @c1_m, @c1.find_symbol('#m')
|
||||||
|
assert_equal @c1__m, @c1.find_symbol('::m')
|
||||||
|
end
|
||||||
|
|
||||||
def test_spaceship
|
def test_spaceship
|
||||||
assert_equal(-1, @c2.<=>(@c3))
|
assert_equal(-1, @c2.<=>(@c3))
|
||||||
assert_equal 0, @c2.<=>(@c2)
|
assert_equal 0, @c2.<=>(@c2)
|
||||||
|
|
|
@ -27,31 +27,30 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
|
||||||
|
|
||||||
refute_ref '#m', '#m'
|
refute_ref '#m', '#m'
|
||||||
|
|
||||||
|
assert_ref '../C1.html#method-c-m', 'C1::m'
|
||||||
assert_ref '../C2/C3.html', 'C2::C3'
|
assert_ref '../C2/C3.html', 'C2::C3'
|
||||||
assert_ref '../C2/C3.html#M000002', 'C2::C3#m'
|
assert_ref '../C2/C3.html#method-i-m', 'C2::C3#m'
|
||||||
assert_ref '../C2/C3/H1.html', 'C3::H1'
|
assert_ref '../C2/C3/H1.html', 'C3::H1'
|
||||||
assert_ref '../C4.html', 'C4'
|
assert_ref '../C4.html', 'C4'
|
||||||
|
|
||||||
# TODO there is a C3::H2 in the top-level namespace and RDoc should follow
|
assert_ref '../C3/H2.html', 'C3::H2'
|
||||||
# constant scoping rules
|
|
||||||
refute_ref 'C3::H2', 'C3::H2'
|
|
||||||
refute_ref 'H1', 'H1'
|
refute_ref 'H1', 'H1'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_C2_C3
|
def test_handle_special_CROSSREF_C2_C3
|
||||||
@xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2/C3.html', @c2_c3, true
|
@xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2/C3.html', @c2_c3, true
|
||||||
|
|
||||||
assert_ref '../../C2/C3.html#M000002', '#m'
|
assert_ref '../../C2/C3.html#method-i-m', '#m'
|
||||||
|
|
||||||
assert_ref '../../C2/C3.html', 'C3'
|
assert_ref '../../C2/C3.html', 'C3'
|
||||||
assert_ref '../../C2/C3.html#M000002', 'C3#m'
|
assert_ref '../../C2/C3.html#method-i-m', 'C3#m'
|
||||||
|
|
||||||
assert_ref '../../C2/C3/H1.html', 'H1'
|
assert_ref '../../C2/C3/H1.html', 'H1'
|
||||||
assert_ref '../../C2/C3/H1.html', 'C3::H1'
|
assert_ref '../../C2/C3/H1.html', 'C3::H1'
|
||||||
|
|
||||||
assert_ref '../../C4.html', 'C4'
|
assert_ref '../../C4.html', 'C4'
|
||||||
|
|
||||||
refute_ref 'C3::H2', 'C3::H2'
|
assert_ref '../../C3/H2.html', 'C3::H2'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_C3
|
def test_handle_special_CROSSREF_C3
|
||||||
|
@ -105,30 +104,34 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_method
|
def test_handle_special_CROSSREF_method
|
||||||
refute_ref 'm', 'm'
|
refute_ref 'm', 'm'
|
||||||
assert_ref 'C1.html#M000000', '#m'
|
assert_ref 'C1.html#method-i-m', '#m'
|
||||||
|
assert_ref 'C1.html#method-c-m', '::m'
|
||||||
|
|
||||||
assert_ref 'C1.html#M000000', 'C1#m'
|
assert_ref 'C1.html#method-i-m', 'C1#m'
|
||||||
assert_ref 'C1.html#M000000', 'C1#m()'
|
assert_ref 'C1.html#method-i-m', 'C1.m'
|
||||||
assert_ref 'C1.html#M000000', 'C1#m(*)'
|
assert_ref 'C1.html#method-c-m', 'C1::m'
|
||||||
|
|
||||||
assert_ref 'C1.html#M000000', 'C1.m'
|
assert_ref 'C1.html#method-i-m', 'C1#m'
|
||||||
assert_ref 'C1.html#M000000', 'C1.m()'
|
assert_ref 'C1.html#method-i-m', 'C1#m()'
|
||||||
assert_ref 'C1.html#M000000', 'C1.m(*)'
|
assert_ref 'C1.html#method-i-m', 'C1#m(*)'
|
||||||
|
|
||||||
# HACK should this work
|
assert_ref 'C1.html#method-i-m', 'C1.m'
|
||||||
#assert_ref 'classes/C1.html#M000001', 'C1::m'
|
assert_ref 'C1.html#method-i-m', 'C1.m()'
|
||||||
#assert_ref 'classes/C1.html#M000001', 'C1::m()'
|
assert_ref 'C1.html#method-i-m', 'C1.m(*)'
|
||||||
#assert_ref 'classes/C1.html#M000001', 'C1::m(*)'
|
|
||||||
|
|
||||||
assert_ref 'C2/C3.html#M000002', 'C2::C3#m'
|
assert_ref 'C1.html#method-c-m', 'C1::m'
|
||||||
|
assert_ref 'C1.html#method-c-m', 'C1::m()'
|
||||||
|
assert_ref 'C1.html#method-c-m', 'C1::m(*)'
|
||||||
|
|
||||||
assert_ref 'C2/C3.html#M000002', 'C2::C3.m'
|
assert_ref 'C2/C3.html#method-i-m', 'C2::C3#m'
|
||||||
|
|
||||||
assert_ref 'C2/C3/H1.html#M000003', 'C2::C3::H1#m?'
|
assert_ref 'C2/C3.html#method-i-m', 'C2::C3.m'
|
||||||
|
|
||||||
assert_ref 'C2/C3.html#M000002', '::C2::C3#m'
|
assert_ref 'C2/C3/H1.html#method-i-m%3F', 'C2::C3::H1#m?'
|
||||||
assert_ref 'C2/C3.html#M000002', '::C2::C3#m()'
|
|
||||||
assert_ref 'C2/C3.html#M000002', '::C2::C3#m(*)'
|
assert_ref 'C2/C3.html#method-i-m', '::C2::C3#m'
|
||||||
|
assert_ref 'C2/C3.html#method-i-m', '::C2::C3#m()'
|
||||||
|
assert_ref 'C2/C3.html#method-i-m', '::C2::C3#m(*)'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_handle_special_CROSSREF_no_ref
|
def test_handle_special_CROSSREF_no_ref
|
||||||
|
|
|
@ -1210,6 +1210,33 @@ EOF
|
||||||
assert_equal 1, @top_level.requires.length
|
assert_equal 1, @top_level.requires.length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_statements_while_begin
|
||||||
|
util_parser <<-RUBY
|
||||||
|
class A
|
||||||
|
def a
|
||||||
|
while begin a; b end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
@parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
|
||||||
|
|
||||||
|
c_a = @top_level.classes.first
|
||||||
|
assert_equal 'A', c_a.full_name
|
||||||
|
|
||||||
|
assert_equal 1, @top_level.classes.length
|
||||||
|
|
||||||
|
m_a = c_a.method_list.first
|
||||||
|
m_b = c_a.method_list.last
|
||||||
|
|
||||||
|
assert_equal 'A#a', m_a.full_name
|
||||||
|
assert_equal 'A#b', m_b.full_name
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_top_level_statements_alias_method
|
def test_parse_top_level_statements_alias_method
|
||||||
content = <<-CONTENT
|
content = <<-CONTENT
|
||||||
class A
|
class A
|
||||||
|
|
|
@ -13,7 +13,6 @@ class XrefTestCase < MiniTest::Unit::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
RDoc::TopLevel.reset
|
RDoc::TopLevel.reset
|
||||||
RDoc::AnyMethod.reset
|
|
||||||
|
|
||||||
@file_name = 'xref_data.rb'
|
@file_name = 'xref_data.rb'
|
||||||
@xref_data = RDoc::TopLevel.new @file_name
|
@xref_data = RDoc::TopLevel.new @file_name
|
||||||
|
@ -36,6 +35,9 @@ class XrefTestCase < MiniTest::Unit::TestCase
|
||||||
rdoc.generator = generator
|
rdoc.generator = generator
|
||||||
|
|
||||||
@c1 = @xref_data.find_module_named 'C1'
|
@c1 = @xref_data.find_module_named 'C1'
|
||||||
|
@c1_m = @c1.method_list.last # C1#m
|
||||||
|
@c1__m = @c1.method_list.first # C1::m
|
||||||
|
|
||||||
@c2 = @xref_data.find_module_named 'C2'
|
@c2 = @xref_data.find_module_named 'C2'
|
||||||
@c2_c3 = @xref_data.find_module_named 'C2::C3'
|
@c2_c3 = @xref_data.find_module_named 'C2::C3'
|
||||||
@c3 = @xref_data.find_module_named 'C3'
|
@c3 = @xref_data.find_module_named 'C3'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue