mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RDoc 6.0.3 from upstream.
It fixed the several bugs that was found after RDoc 6 releasing. From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ee83dc3fe4
commit
98c7058bf7
94 changed files with 983 additions and 466 deletions
|
@ -65,7 +65,7 @@ module RDoc
|
||||||
##
|
##
|
||||||
# RDoc version you are using
|
# RDoc version you are using
|
||||||
|
|
||||||
VERSION = '6.0.1'
|
VERSION = '6.0.3'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Method visibilities
|
# Method visibilities
|
||||||
|
@ -125,8 +125,6 @@ module RDoc
|
||||||
|
|
||||||
autoload :RDoc, 'rdoc/rdoc'
|
autoload :RDoc, 'rdoc/rdoc'
|
||||||
|
|
||||||
autoload :TestCase, 'rdoc/test_case'
|
|
||||||
|
|
||||||
autoload :CrossReference, 'rdoc/cross_reference'
|
autoload :CrossReference, 'rdoc/cross_reference'
|
||||||
autoload :ERBIO, 'rdoc/erbio'
|
autoload :ERBIO, 'rdoc/erbio'
|
||||||
autoload :ERBPartial, 'rdoc/erb_partial'
|
autoload :ERBPartial, 'rdoc/erb_partial'
|
||||||
|
@ -153,7 +151,7 @@ module RDoc
|
||||||
|
|
||||||
autoload :Comment, 'rdoc/comment'
|
autoload :Comment, 'rdoc/comment'
|
||||||
|
|
||||||
autoload :I18n, 'rdoc/i18n'
|
require 'rdoc/i18n'
|
||||||
|
|
||||||
# code objects
|
# code objects
|
||||||
#
|
#
|
||||||
|
|
|
@ -407,6 +407,7 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
mod.section = current_section # TODO declaring context? something is
|
mod.section = current_section # TODO declaring context? something is
|
||||||
# wrong here...
|
# wrong here...
|
||||||
mod.parent = self
|
mod.parent = self
|
||||||
|
mod.full_name = nil
|
||||||
mod.store = @store
|
mod.store = @store
|
||||||
|
|
||||||
unless @done_documenting then
|
unless @done_documenting then
|
||||||
|
@ -414,6 +415,10 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
# this must be done AFTER adding mod to its parent, so that the full
|
# this must be done AFTER adding mod to its parent, so that the full
|
||||||
# name is correct:
|
# name is correct:
|
||||||
all_hash[mod.full_name] = mod
|
all_hash[mod.full_name] = mod
|
||||||
|
if @store.unmatched_constant_alias[mod.full_name] then
|
||||||
|
to, file = @store.unmatched_constant_alias[mod.full_name]
|
||||||
|
add_module_alias mod, mod.name, to, file
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mod
|
mod
|
||||||
|
@ -510,41 +515,53 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
add_class_or_module mod, @modules, @store.modules_hash
|
add_class_or_module mod, @modules, @store.modules_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Adds a module by +RDoc::NormalModule+ instance. See also #add_module.
|
||||||
|
|
||||||
|
def add_module_by_normal_module(mod)
|
||||||
|
add_class_or_module mod, @modules, @store.modules_hash
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Adds an alias from +from+ (a class or module) to +name+ which was defined
|
# Adds an alias from +from+ (a class or module) to +name+ which was defined
|
||||||
# in +file+.
|
# in +file+.
|
||||||
|
|
||||||
def add_module_alias from, name, file
|
def add_module_alias from, from_name, to, file
|
||||||
return from if @done_documenting
|
return from if @done_documenting
|
||||||
|
|
||||||
to_name = child_name name
|
to_full_name = child_name to.name
|
||||||
|
|
||||||
# if we already know this name, don't register an alias:
|
# if we already know this name, don't register an alias:
|
||||||
# see the metaprogramming in lib/active_support/basic_object.rb,
|
# see the metaprogramming in lib/active_support/basic_object.rb,
|
||||||
# where we already know BasicObject is a class when we find
|
# where we already know BasicObject is a class when we find
|
||||||
# BasicObject = BlankSlate
|
# BasicObject = BlankSlate
|
||||||
return from if @store.find_class_or_module to_name
|
return from if @store.find_class_or_module to_full_name
|
||||||
|
|
||||||
to = from.dup
|
unless from
|
||||||
to.name = name
|
@store.unmatched_constant_alias[child_name(from_name)] = [to, file]
|
||||||
to.full_name = nil
|
return to
|
||||||
|
end
|
||||||
|
|
||||||
if to.module? then
|
new_to = from.dup
|
||||||
@store.modules_hash[to_name] = to
|
new_to.name = to.name
|
||||||
@modules[name] = to
|
new_to.full_name = nil
|
||||||
|
|
||||||
|
if new_to.module? then
|
||||||
|
@store.modules_hash[to_full_name] = new_to
|
||||||
|
@modules[to.name] = new_to
|
||||||
else
|
else
|
||||||
@store.classes_hash[to_name] = to
|
@store.classes_hash[to_full_name] = new_to
|
||||||
@classes[name] = to
|
@classes[to.name] = new_to
|
||||||
end
|
end
|
||||||
|
|
||||||
# Registers a constant for this alias. The constant value and comment
|
# Registers a constant for this alias. The constant value and comment
|
||||||
# will be updated later, when the Ruby parser adds the constant
|
# will be updated later, when the Ruby parser adds the constant
|
||||||
const = RDoc::Constant.new name, nil, to.comment
|
const = RDoc::Constant.new to.name, nil, new_to.comment
|
||||||
const.record_location file
|
const.record_location file
|
||||||
const.is_alias_for = from
|
const.is_alias_for = from
|
||||||
add_constant const
|
add_constant const
|
||||||
|
|
||||||
to
|
new_to
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -863,7 +880,13 @@ class RDoc::Context < RDoc::CodeObject
|
||||||
# Finds a method named +name+ with singleton value +singleton+.
|
# Finds a method named +name+ with singleton value +singleton+.
|
||||||
|
|
||||||
def find_method(name, singleton)
|
def find_method(name, singleton)
|
||||||
@method_list.find { |m| m.name == name && m.singleton == singleton }
|
@method_list.find { |m|
|
||||||
|
if m.singleton
|
||||||
|
m.name == name && m.singleton == singleton
|
||||||
|
else
|
||||||
|
m.name == name && !m.singleton && !singleton
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -7,6 +7,18 @@
|
||||||
|
|
||||||
module RDoc::Encoding
|
module RDoc::Encoding
|
||||||
|
|
||||||
|
HEADER_REGEXP = /^
|
||||||
|
(?:
|
||||||
|
\A\#!.*\n
|
||||||
|
|
|
||||||
|
^\#\s+frozen[-_]string[-_]literal[=:].+\n
|
||||||
|
|
|
||||||
|
^\#[^\n]+\b(?:en)?coding[=:]\s*(?<name>[^\s;]+).*\n
|
||||||
|
|
|
||||||
|
<\?xml[^?]*encoding=(?<quote>["'])(?<name>.*?)\k<quote>.*\n
|
||||||
|
)+
|
||||||
|
/xi # :nodoc:
|
||||||
|
|
||||||
##
|
##
|
||||||
# Reads the contents of +filename+ and handles any encoding directives in
|
# Reads the contents of +filename+ and handles any encoding directives in
|
||||||
# the file.
|
# the file.
|
||||||
|
@ -18,12 +30,13 @@ module RDoc::Encoding
|
||||||
# unknown character in the target encoding will be replaced with '?'
|
# unknown character in the target encoding will be replaced with '?'
|
||||||
|
|
||||||
def self.read_file filename, encoding, force_transcode = false
|
def self.read_file filename, encoding, force_transcode = false
|
||||||
content = open filename, "rb" do |f| f.read end
|
content = File.open filename, "rb" do |f| f.read end
|
||||||
content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
|
content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
|
||||||
|
|
||||||
utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
|
utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
|
||||||
|
|
||||||
content = RDoc::Encoding.set_encoding content
|
enc = RDoc::Encoding.detect_encoding content
|
||||||
|
content = RDoc::Encoding.change_encoding content, enc if enc
|
||||||
|
|
||||||
begin
|
begin
|
||||||
encoding ||= Encoding.default_external
|
encoding ||= Encoding.default_external
|
||||||
|
@ -85,29 +98,22 @@ module RDoc::Encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Sets the encoding of +string+ based on the magic comment
|
# Detects the encoding of +string+ based on the magic comment
|
||||||
|
|
||||||
def self.set_encoding string
|
def self.detect_encoding string
|
||||||
string = remove_frozen_string_literal string
|
result = HEADER_REGEXP.match string
|
||||||
|
name = result && result[:name]
|
||||||
|
|
||||||
string =~ /\A(?:#!.*\n)?(.*\n)/
|
name ? Encoding.find(name) : nil
|
||||||
|
end
|
||||||
|
|
||||||
first_line = $1
|
##
|
||||||
|
# Removes magic comments and shebang
|
||||||
|
|
||||||
name = case first_line
|
def self.remove_magic_comment string
|
||||||
when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2
|
string.sub HEADER_REGEXP do |s|
|
||||||
when /\b(?:en)?coding[=:]\s*([^\s;]+)/i then $1
|
s.gsub(/[^\n]/, '')
|
||||||
else return string
|
end
|
||||||
end
|
|
||||||
|
|
||||||
string = string.sub first_line, ''
|
|
||||||
|
|
||||||
string = remove_frozen_string_literal string
|
|
||||||
|
|
||||||
enc = Encoding.find name
|
|
||||||
string = RDoc::Encoding.change_encoding string, enc if enc
|
|
||||||
|
|
||||||
string
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -9,7 +9,7 @@ require 'erb'
|
||||||
#
|
#
|
||||||
# erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil
|
# erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil
|
||||||
#
|
#
|
||||||
# open 'hello.txt', 'w' do |io|
|
# File.open 'hello.txt', 'w' do |io|
|
||||||
# erbio.result binding
|
# erbio.result binding
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
|
|
|
@ -147,12 +147,15 @@ class RDoc::Generator::JsonIndex
|
||||||
|
|
||||||
JSON.dump data, io, 0
|
JSON.dump data, io, 0
|
||||||
end
|
end
|
||||||
|
unless ENV['SOURCE_DATE_EPOCH'].nil?
|
||||||
|
index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
|
||||||
|
end
|
||||||
|
|
||||||
Dir.chdir @template_dir do
|
Dir.chdir @template_dir do
|
||||||
Dir['**/*.js'].each do |source|
|
Dir['**/*.js'].each do |source|
|
||||||
dest = File.join out_dir, source
|
dest = File.join out_dir, source
|
||||||
|
|
||||||
FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC
|
FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,8 +91,8 @@ class RDoc::Generator::POT
|
||||||
extractor.extract
|
extractor.extract
|
||||||
end
|
end
|
||||||
|
|
||||||
autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor'
|
require 'rdoc/generator/pot/message_extractor'
|
||||||
autoload :PO, 'rdoc/generator/pot/po'
|
require 'rdoc/generator/pot/po'
|
||||||
autoload :POEntry, 'rdoc/generator/pot/po_entry'
|
require 'rdoc/generator/pot/po_entry'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
module RDoc::I18n
|
module RDoc::I18n
|
||||||
|
|
||||||
autoload :Locale, 'rdoc/i18n/locale'
|
autoload :Locale, 'rdoc/i18n/locale'
|
||||||
autoload :Text, 'rdoc/i18n/text'
|
require 'rdoc/i18n/text'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# coding: UTF-8
|
# coding: UTF-8
|
||||||
|
# frozen_string_literal: true
|
||||||
# :markup: markdown
|
# :markup: markdown
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# coding: UTF-8
|
# coding: UTF-8
|
||||||
|
# frozen_string_literal: true
|
||||||
# :markup: markdown
|
# :markup: markdown
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -266,6 +266,7 @@ class RDoc::Markup::PreProcess
|
||||||
end
|
end
|
||||||
|
|
||||||
content = RDoc::Encoding.read_file full_name, encoding, true
|
content = RDoc::Encoding.read_file full_name, encoding, true
|
||||||
|
content = RDoc::Encoding.remove_magic_comment content
|
||||||
|
|
||||||
# strip magic comment
|
# strip magic comment
|
||||||
content = content.sub(/\A# .*coding[=:].*$/, '').lstrip
|
content = content.sub(/\A# .*coding[=:].*$/, '').lstrip
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ Usage: #{opt.program_name} [options] [names...]
|
||||||
def write_options
|
def write_options
|
||||||
RDoc.load_yaml
|
RDoc.load_yaml
|
||||||
|
|
||||||
open '.rdoc_options', 'w' do |io|
|
File.open '.rdoc_options', 'w' do |io|
|
||||||
io.set_encoding Encoding::UTF_8
|
io.set_encoding Encoding::UTF_8
|
||||||
|
|
||||||
YAML.dump self, io
|
YAML.dump self, io
|
||||||
|
|
|
@ -139,7 +139,7 @@ class RDoc::Parser
|
||||||
# Returns the file type from the modeline in +file_name+
|
# Returns the file type from the modeline in +file_name+
|
||||||
|
|
||||||
def self.check_modeline file_name
|
def self.check_modeline file_name
|
||||||
line = open file_name do |io|
|
line = File.open file_name do |io|
|
||||||
io.gets
|
io.gets
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
require 'ripper'
|
require 'ripper'
|
||||||
|
|
||||||
class RDoc::RipperStateLex
|
class RDoc::RipperStateLex
|
||||||
|
@ -83,6 +84,15 @@ class RDoc::RipperStateLex
|
||||||
when '&&', '||', '+=', '-=', '*=', '**=',
|
when '&&', '||', '+=', '-=', '*=', '**=',
|
||||||
'&=', '|=', '^=', '<<=', '>>=', '||=', '&&='
|
'&=', '|=', '^=', '<<=', '>>=', '||=', '&&='
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
|
when '::'
|
||||||
|
case @lex_state
|
||||||
|
when EXPR_ARG, EXPR_CMDARG
|
||||||
|
@lex_state = EXPR_DOT
|
||||||
|
when EXPR_FNAME, EXPR_DOT
|
||||||
|
@lex_state = EXPR_ARG
|
||||||
|
else
|
||||||
|
@lex_state = EXPR_BEG
|
||||||
|
end
|
||||||
else
|
else
|
||||||
case @lex_state
|
case @lex_state
|
||||||
when EXPR_FNAME, EXPR_DOT
|
when EXPR_FNAME, EXPR_DOT
|
||||||
|
@ -109,8 +119,10 @@ class RDoc::RipperStateLex
|
||||||
else
|
else
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
end
|
end
|
||||||
when 'begin'
|
when 'begin', 'case', 'when'
|
||||||
@lex_state = EXPR_BEG
|
@lex_state = EXPR_BEG
|
||||||
|
when 'return', 'break'
|
||||||
|
@lex_state = EXPR_MID
|
||||||
else
|
else
|
||||||
if @lex_state == EXPR_FNAME
|
if @lex_state == EXPR_FNAME
|
||||||
@lex_state = EXPR_END
|
@lex_state = EXPR_END
|
||||||
|
@ -245,7 +257,7 @@ class RDoc::RipperStateLex
|
||||||
case @lex_state
|
case @lex_state
|
||||||
when EXPR_FNAME
|
when EXPR_FNAME
|
||||||
@lex_state = EXPR_ENDFN
|
@lex_state = EXPR_ENDFN
|
||||||
when EXPR_CLASS
|
when EXPR_CLASS, EXPR_CMDARG, EXPR_MID
|
||||||
@lex_state = EXPR_ARG
|
@lex_state = EXPR_ARG
|
||||||
else
|
else
|
||||||
@lex_state = EXPR_CMDARG
|
@lex_state = EXPR_CMDARG
|
||||||
|
@ -330,8 +342,10 @@ class RDoc::RipperStateLex
|
||||||
@heredoc_queue << retrieve_heredoc_info(tk)
|
@heredoc_queue << retrieve_heredoc_info(tk)
|
||||||
@inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE
|
@inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE
|
||||||
when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then
|
when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then
|
||||||
unless @heredoc_queue.empty?
|
if !@heredoc_queue.empty?
|
||||||
get_heredoc_tk(*@heredoc_queue.shift)
|
get_heredoc_tk(*@heredoc_queue.shift)
|
||||||
|
elsif tk[:text].nil? # :on_ignored_nl sometimes gives nil
|
||||||
|
tk[:text] = ''
|
||||||
end
|
end
|
||||||
when :on_words_beg then
|
when :on_words_beg then
|
||||||
tk = get_words_tk(tk)
|
tk = get_words_tk(tk)
|
||||||
|
|
|
@ -177,6 +177,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
@size = 0
|
@size = 0
|
||||||
@token_listeners = nil
|
@token_listeners = nil
|
||||||
|
content = RDoc::Encoding.remove_magic_comment content
|
||||||
@scanner = RDoc::RipperStateLex.parse(content)
|
@scanner = RDoc::RipperStateLex.parse(content)
|
||||||
@content = content
|
@content = content
|
||||||
@scanner_point = 0
|
@scanner_point = 0
|
||||||
|
@ -306,7 +307,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
container.find_module_named rhs_name
|
container.find_module_named rhs_name
|
||||||
end
|
end
|
||||||
|
|
||||||
container.add_module_alias mod, constant.name, @top_level if mod
|
container.add_module_alias mod, rhs_name, constant, @top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -355,12 +356,15 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
given_name << name_t[:text]
|
given_name << name_t[:text]
|
||||||
|
|
||||||
is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'
|
is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'
|
||||||
|
new_modules = []
|
||||||
while !is_self && (tk = peek_tk) and :on_op == tk[:kind] and '::' == tk[:text] do
|
while !is_self && (tk = peek_tk) and :on_op == tk[:kind] and '::' == tk[:text] do
|
||||||
prev_container = container
|
prev_container = container
|
||||||
container = container.find_module_named name_t[:text]
|
container = container.find_module_named name_t[:text]
|
||||||
container ||=
|
container ||=
|
||||||
if ignore_constants then
|
if ignore_constants then
|
||||||
RDoc::Context.new
|
c = RDoc::NormalModule.new name_t[:text]
|
||||||
|
new_modules << [prev_container, c]
|
||||||
|
c
|
||||||
else
|
else
|
||||||
c = prev_container.add_module RDoc::NormalModule, name_t[:text]
|
c = prev_container.add_module RDoc::NormalModule, name_t[:text]
|
||||||
c.ignore unless prev_container.document_children
|
c.ignore unless prev_container.document_children
|
||||||
|
@ -385,7 +389,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
skip_tkspace false
|
skip_tkspace false
|
||||||
|
|
||||||
return [container, name_t, given_name]
|
return [container, name_t, given_name, new_modules]
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -760,7 +764,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
line_no = tk[:line_no]
|
line_no = tk[:line_no]
|
||||||
|
|
||||||
declaration_context = container
|
declaration_context = container
|
||||||
container, name_t, given_name = get_class_or_module container
|
container, name_t, given_name, = get_class_or_module container
|
||||||
|
|
||||||
if name_t[:kind] == :on_const
|
if name_t[:kind] == :on_const
|
||||||
cls = parse_class_regular container, declaration_context, single,
|
cls = parse_class_regular container, declaration_context, single,
|
||||||
|
@ -877,10 +881,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
return unless name =~ /^\w+$/
|
return unless name =~ /^\w+$/
|
||||||
|
|
||||||
|
new_modules = []
|
||||||
if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then
|
if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then
|
||||||
unget_tk tk
|
unget_tk tk
|
||||||
|
|
||||||
container, name_t, = get_class_or_module container, ignore_constants
|
container, name_t, _, new_modules = get_class_or_module container, true
|
||||||
|
|
||||||
name = name_t[:text]
|
name = name_t[:text]
|
||||||
end
|
end
|
||||||
|
@ -907,6 +912,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
end
|
end
|
||||||
get_tk
|
get_tk
|
||||||
|
|
||||||
|
unless ignore_constants
|
||||||
|
new_modules.each do |prev_c, new_module|
|
||||||
|
prev_c.add_module_by_normal_module new_module
|
||||||
|
new_module.ignore unless prev_c.document_children
|
||||||
|
@top_level.add_to_classes_or_modules new_module
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
value = ''
|
value = ''
|
||||||
con = RDoc::Constant.new name, value, comment
|
con = RDoc::Constant.new name, value, comment
|
||||||
|
|
||||||
|
@ -2074,13 +2087,16 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
$stderr.puts @file_name
|
$stderr.puts @file_name
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
bytes = ''
|
|
||||||
|
|
||||||
if @scanner_point >= @scanner.size
|
if @scanner_point >= @scanner.size
|
||||||
now_line_no = @scanner[@scanner.size - 1][:line_no]
|
now_line_no = @scanner[@scanner.size - 1][:line_no]
|
||||||
else
|
else
|
||||||
now_line_no = peek_tk[:line_no]
|
now_line_no = peek_tk[:line_no]
|
||||||
end
|
end
|
||||||
|
first_tk_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no }
|
||||||
|
last_tk_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no + 1 }
|
||||||
|
last_tk_index = last_tk_index ? last_tk_index - 1 : @scanner.size - 1
|
||||||
|
code = @scanner[first_tk_index..last_tk_index].map{ |t| t[:text] }.join
|
||||||
|
|
||||||
$stderr.puts <<-EOF
|
$stderr.puts <<-EOF
|
||||||
|
|
||||||
|
@ -2089,12 +2105,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
unless bytes.empty? then
|
unless code.empty? then
|
||||||
|
$stderr.puts code
|
||||||
$stderr.puts
|
$stderr.puts
|
||||||
now_line_no = peek_tk[:line_no]
|
|
||||||
start_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no }
|
|
||||||
end_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no + 1 } - 1
|
|
||||||
$stderr.puts @scanner[start_index..end_index].join
|
|
||||||
end
|
end
|
||||||
|
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# DO NOT MODIFY!!!!
|
# DO NOT MODIFY!!!!
|
||||||
# This file is automatically generated by Racc 1.4.14
|
# This file is automatically generated by Racc 1.4.14
|
||||||
|
@ -207,7 +208,7 @@ def next_token # :nodoc:
|
||||||
if @in_verbatim
|
if @in_verbatim
|
||||||
[:STRINGLINE, line]
|
[:STRINGLINE, line]
|
||||||
else
|
else
|
||||||
@indent_stack.push("\s" << newIndent)
|
@indent_stack.push("\s" + newIndent)
|
||||||
[:ITEMLISTLINE, rest]
|
[:ITEMLISTLINE, rest]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -219,7 +220,7 @@ def next_token # :nodoc:
|
||||||
if @in_verbatim
|
if @in_verbatim
|
||||||
[:STRINGLINE, line]
|
[:STRINGLINE, line]
|
||||||
else
|
else
|
||||||
@indent_stack.push("\s" * mark.size << newIndent)
|
@indent_stack.push("\s" * mark.size + newIndent)
|
||||||
[:ENUMLISTLINE, rest]
|
[:ENUMLISTLINE, rest]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -677,54 +678,54 @@ Racc_debug_parser = false
|
||||||
# reduce 0 omitted
|
# reduce 0 omitted
|
||||||
|
|
||||||
def _reduce_1(val, _values, result)
|
def _reduce_1(val, _values, result)
|
||||||
result = RDoc::Markup::Document.new(*val[0])
|
result = RDoc::Markup::Document.new(*val[0])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_2(val, _values, result)
|
def _reduce_2(val, _values, result)
|
||||||
raise ParseError, "file empty"
|
raise ParseError, "file empty"
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_3(val, _values, result)
|
def _reduce_3(val, _values, result)
|
||||||
result = val[0].concat val[1]
|
result = val[0].concat val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_4(val, _values, result)
|
def _reduce_4(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_5(val, _values, result)
|
def _reduce_5(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_6(val, _values, result)
|
def _reduce_6(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 7 omitted
|
# reduce 7 omitted
|
||||||
|
|
||||||
def _reduce_8(val, _values, result)
|
def _reduce_8(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_9(val, _values, result)
|
def _reduce_9(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_10(val, _values, result)
|
def _reduce_10(val, _values, result)
|
||||||
result = [RDoc::Markup::BlankLine.new]
|
result = [RDoc::Markup::BlankLine.new]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_11(val, _values, result)
|
def _reduce_11(val, _values, result)
|
||||||
result = val[0].parts
|
result = val[0].parts
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -732,30 +733,30 @@ def _reduce_12(val, _values, result)
|
||||||
# val[0] is like [level, title]
|
# val[0] is like [level, title]
|
||||||
title = @inline_parser.parse(val[0][1])
|
title = @inline_parser.parse(val[0][1])
|
||||||
result = RDoc::Markup::Heading.new(val[0][0], title)
|
result = RDoc::Markup::Heading.new(val[0][0], title)
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_13(val, _values, result)
|
def _reduce_13(val, _values, result)
|
||||||
result = RDoc::Markup::Include.new val[0], @include_path
|
result = RDoc::Markup::Include.new val[0], @include_path
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_14(val, _values, result)
|
def _reduce_14(val, _values, result)
|
||||||
# val[0] is Array of String
|
# val[0] is Array of String
|
||||||
result = paragraph val[0]
|
result = paragraph val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_15(val, _values, result)
|
def _reduce_15(val, _values, result)
|
||||||
result << val[1].rstrip
|
result << val[1].rstrip
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_16(val, _values, result)
|
def _reduce_16(val, _values, result)
|
||||||
result = [val[0].rstrip]
|
result = [val[0].rstrip]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -766,7 +767,7 @@ def _reduce_17(val, _values, result)
|
||||||
|
|
||||||
# imform to lexer.
|
# imform to lexer.
|
||||||
@in_verbatim = false
|
@in_verbatim = false
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -777,25 +778,25 @@ def _reduce_18(val, _values, result)
|
||||||
|
|
||||||
# imform to lexer.
|
# imform to lexer.
|
||||||
@in_verbatim = false
|
@in_verbatim = false
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_19(val, _values, result)
|
def _reduce_19(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_20(val, _values, result)
|
def _reduce_20(val, _values, result)
|
||||||
result.concat val[2]
|
result.concat val[2]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_21(val, _values, result)
|
def _reduce_21(val, _values, result)
|
||||||
result << "\n"
|
result << "\n"
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -803,7 +804,7 @@ def _reduce_22(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
# inform to lexer.
|
# inform to lexer.
|
||||||
@in_verbatim = true
|
@in_verbatim = true
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -817,89 +818,89 @@ end
|
||||||
|
|
||||||
def _reduce_27(val, _values, result)
|
def _reduce_27(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_28(val, _values, result)
|
def _reduce_28(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_29(val, _values, result)
|
def _reduce_29(val, _values, result)
|
||||||
result = val[1].push(val[2])
|
result = val[1].push(val[2])
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_30(val, _values, result)
|
def _reduce_30(val, _values, result)
|
||||||
result = val[0] << val[1]
|
result = val[0] << val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_31(val, _values, result)
|
def _reduce_31(val, _values, result)
|
||||||
result = [val[0]]
|
result = [val[0]]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_32(val, _values, result)
|
def _reduce_32(val, _values, result)
|
||||||
result = RDoc::Markup::List.new :BULLET, *val[0]
|
result = RDoc::Markup::List.new :BULLET, *val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_33(val, _values, result)
|
def _reduce_33(val, _values, result)
|
||||||
result.push(val[1])
|
result.push(val[1])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_34(val, _values, result)
|
def _reduce_34(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_35(val, _values, result)
|
def _reduce_35(val, _values, result)
|
||||||
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_36(val, _values, result)
|
def _reduce_36(val, _values, result)
|
||||||
result = RDoc::Markup::List.new :NUMBER, *val[0]
|
result = RDoc::Markup::List.new :NUMBER, *val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_37(val, _values, result)
|
def _reduce_37(val, _values, result)
|
||||||
result.push(val[1])
|
result.push(val[1])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_38(val, _values, result)
|
def _reduce_38(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_39(val, _values, result)
|
def _reduce_39(val, _values, result)
|
||||||
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_40(val, _values, result)
|
def _reduce_40(val, _values, result)
|
||||||
result = RDoc::Markup::List.new :NOTE, *val[0]
|
result = RDoc::Markup::List.new :NOTE, *val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_41(val, _values, result)
|
def _reduce_41(val, _values, result)
|
||||||
result.push(val[1])
|
result.push(val[1])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_42(val, _values, result)
|
def _reduce_42(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -907,77 +908,77 @@ def _reduce_43(val, _values, result)
|
||||||
term = @inline_parser.parse val[0].strip
|
term = @inline_parser.parse val[0].strip
|
||||||
|
|
||||||
result = RDoc::Markup::ListItem.new term, *val[1]
|
result = RDoc::Markup::ListItem.new term, *val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_44(val, _values, result)
|
def _reduce_44(val, _values, result)
|
||||||
result = RDoc::Markup::List.new :LABEL, *val[0]
|
result = RDoc::Markup::List.new :LABEL, *val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_45(val, _values, result)
|
def _reduce_45(val, _values, result)
|
||||||
result.push(val[1])
|
result.push(val[1])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_46(val, _values, result)
|
def _reduce_46(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_47(val, _values, result)
|
def _reduce_47(val, _values, result)
|
||||||
result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
|
result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_48(val, _values, result)
|
def _reduce_48(val, _values, result)
|
||||||
result = [val[1]].concat(val[2])
|
result = [val[1]].concat(val[2])
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_49(val, _values, result)
|
def _reduce_49(val, _values, result)
|
||||||
result = [val[1]]
|
result = [val[1]]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_50(val, _values, result)
|
def _reduce_50(val, _values, result)
|
||||||
result = val[2]
|
result = val[2]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_51(val, _values, result)
|
def _reduce_51(val, _values, result)
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_52(val, _values, result)
|
def _reduce_52(val, _values, result)
|
||||||
result.concat val[1]
|
result.concat val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 53 omitted
|
# reduce 53 omitted
|
||||||
|
|
||||||
def _reduce_54(val, _values, result)
|
def _reduce_54(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_55(val, _values, result)
|
def _reduce_55(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 56 omitted
|
# reduce 56 omitted
|
||||||
|
|
||||||
def _reduce_57(val, _values, result)
|
def _reduce_57(val, _values, result)
|
||||||
result = []
|
result = []
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -991,58 +992,58 @@ end
|
||||||
|
|
||||||
def _reduce_62(val, _values, result)
|
def _reduce_62(val, _values, result)
|
||||||
result = paragraph [val[0]].concat(val[1])
|
result = paragraph [val[0]].concat(val[1])
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_63(val, _values, result)
|
def _reduce_63(val, _values, result)
|
||||||
result = paragraph [val[0]]
|
result = paragraph [val[0]]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_64(val, _values, result)
|
def _reduce_64(val, _values, result)
|
||||||
result = paragraph [val[0]].concat(val[1])
|
result = paragraph [val[0]].concat(val[1])
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_65(val, _values, result)
|
def _reduce_65(val, _values, result)
|
||||||
result = paragraph [val[0]]
|
result = paragraph [val[0]]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_66(val, _values, result)
|
def _reduce_66(val, _values, result)
|
||||||
result = [val[0]].concat(val[1])
|
result = [val[0]].concat(val[1])
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_67(val, _values, result)
|
def _reduce_67(val, _values, result)
|
||||||
result.concat val[1]
|
result.concat val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_68(val, _values, result)
|
def _reduce_68(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_69(val, _values, result)
|
def _reduce_69(val, _values, result)
|
||||||
result = val
|
result = val
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 70 omitted
|
# reduce 70 omitted
|
||||||
|
|
||||||
def _reduce_71(val, _values, result)
|
def _reduce_71(val, _values, result)
|
||||||
result = []
|
result = []
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_72(val, _values, result)
|
def _reduce_72(val, _values, result)
|
||||||
result = []
|
result = []
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# DO NOT MODIFY!!!!
|
# DO NOT MODIFY!!!!
|
||||||
# This file is automatically generated by Racc 1.4.14
|
# This file is automatically generated by Racc 1.4.14
|
||||||
|
@ -96,7 +97,7 @@ end
|
||||||
def parse inline
|
def parse inline
|
||||||
@inline = inline
|
@inline = inline
|
||||||
@src = StringScanner.new inline
|
@src = StringScanner.new inline
|
||||||
@pre = ""
|
@pre = "".dup
|
||||||
@yydebug = true
|
@yydebug = true
|
||||||
do_parse.to_s
|
do_parse.to_s
|
||||||
end
|
end
|
||||||
|
@ -732,12 +733,12 @@ Racc_debug_parser = false
|
||||||
# reduce 1 omitted
|
# reduce 1 omitted
|
||||||
|
|
||||||
def _reduce_2(val, _values, result)
|
def _reduce_2(val, _values, result)
|
||||||
result.append val[1]
|
result.append val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_3(val, _values, result)
|
def _reduce_3(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -762,28 +763,28 @@ end
|
||||||
def _reduce_13(val, _values, result)
|
def _reduce_13(val, _values, result)
|
||||||
content = val[1]
|
content = val[1]
|
||||||
result = inline "<em>#{content}</em>", content
|
result = inline "<em>#{content}</em>", content
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_14(val, _values, result)
|
def _reduce_14(val, _values, result)
|
||||||
content = val[1]
|
content = val[1]
|
||||||
result = inline "<code>#{content}</code>", content
|
result = inline "<code>#{content}</code>", content
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_15(val, _values, result)
|
def _reduce_15(val, _values, result)
|
||||||
content = val[1]
|
content = val[1]
|
||||||
result = inline "+#{content}+", content
|
result = inline "+#{content}+", content
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_16(val, _values, result)
|
def _reduce_16(val, _values, result)
|
||||||
content = val[1]
|
content = val[1]
|
||||||
result = inline "<tt>#{content}</tt>", content
|
result = inline "<tt>#{content}</tt>", content
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -791,13 +792,13 @@ def _reduce_17(val, _values, result)
|
||||||
label = val[1]
|
label = val[1]
|
||||||
@block_parser.add_label label.reference
|
@block_parser.add_label label.reference
|
||||||
result = "<span id=\"label-#{label}\">#{label}</span>"
|
result = "<span id=\"label-#{label}\">#{label}</span>"
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_18(val, _values, result)
|
def _reduce_18(val, _values, result)
|
||||||
result = "{#{val[1]}}[#{val[2].join}]"
|
result = "{#{val[1]}}[#{val[2].join}]"
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -805,13 +806,13 @@ def _reduce_19(val, _values, result)
|
||||||
scheme, inline = val[1]
|
scheme, inline = val[1]
|
||||||
|
|
||||||
result = "{#{inline}}[#{scheme}#{inline.reference}]"
|
result = "{#{inline}}[#{scheme}#{inline.reference}]"
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_20(val, _values, result)
|
def _reduce_20(val, _values, result)
|
||||||
result = [nil, inline(val[1])]
|
result = [nil, inline(val[1])]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -820,25 +821,25 @@ def _reduce_21(val, _values, result)
|
||||||
'rdoc-label:',
|
'rdoc-label:',
|
||||||
inline("#{val[0].reference}/#{val[1].reference}")
|
inline("#{val[0].reference}/#{val[1].reference}")
|
||||||
]
|
]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_22(val, _values, result)
|
def _reduce_22(val, _values, result)
|
||||||
result = ['rdoc-label:', val[0].reference]
|
result = ['rdoc-label:', val[0].reference]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_23(val, _values, result)
|
def _reduce_23(val, _values, result)
|
||||||
result = ['rdoc-label:', "#{val[0].reference}/"]
|
result = ['rdoc-label:', "#{val[0].reference}/"]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_24(val, _values, result)
|
def _reduce_24(val, _values, result)
|
||||||
result = [nil, inline(val[1])]
|
result = [nil, inline(val[1])]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -847,92 +848,92 @@ def _reduce_25(val, _values, result)
|
||||||
'rdoc-label:',
|
'rdoc-label:',
|
||||||
inline("#{val[0].reference}/#{val[1].reference}")
|
inline("#{val[0].reference}/#{val[1].reference}")
|
||||||
]
|
]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_26(val, _values, result)
|
def _reduce_26(val, _values, result)
|
||||||
result = ['rdoc-label:', val[0]]
|
result = ['rdoc-label:', val[0]]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_27(val, _values, result)
|
def _reduce_27(val, _values, result)
|
||||||
ref = val[0].reference
|
ref = val[0].reference
|
||||||
result = ['rdoc-label:', inline(ref, "#{ref}/")]
|
result = ['rdoc-label:', inline(ref, "#{ref}/")]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 28 omitted
|
# reduce 28 omitted
|
||||||
|
|
||||||
def _reduce_29(val, _values, result)
|
def _reduce_29(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_30(val, _values, result)
|
def _reduce_30(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_31(val, _values, result)
|
def _reduce_31(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_32(val, _values, result)
|
def _reduce_32(val, _values, result)
|
||||||
result = inline "\"#{val[1]}\""
|
result = inline "\"#{val[1]}\""
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_33(val, _values, result)
|
def _reduce_33(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_34(val, _values, result)
|
def _reduce_34(val, _values, result)
|
||||||
result = inline "\"#{val[1]}\""
|
result = inline "\"#{val[1]}\""
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 35 omitted
|
# reduce 35 omitted
|
||||||
|
|
||||||
def _reduce_36(val, _values, result)
|
def _reduce_36(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_37(val, _values, result)
|
def _reduce_37(val, _values, result)
|
||||||
result = inline val[1]
|
result = inline val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_38(val, _values, result)
|
def _reduce_38(val, _values, result)
|
||||||
result = val[0].append val[1]
|
result = val[0].append val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_39(val, _values, result)
|
def _reduce_39(val, _values, result)
|
||||||
result = val[0].append val[1]
|
result = val[0].append val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_40(val, _values, result)
|
def _reduce_40(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_41(val, _values, result)
|
def _reduce_41(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -940,25 +941,25 @@ end
|
||||||
|
|
||||||
def _reduce_43(val, _values, result)
|
def _reduce_43(val, _values, result)
|
||||||
result = val[0].append val[1]
|
result = val[0].append val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_44(val, _values, result)
|
def _reduce_44(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_45(val, _values, result)
|
def _reduce_45(val, _values, result)
|
||||||
result = val[0].append val[1]
|
result = val[0].append val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_46(val, _values, result)
|
def _reduce_46(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -984,24 +985,24 @@ end
|
||||||
|
|
||||||
def _reduce_57(val, _values, result)
|
def _reduce_57(val, _values, result)
|
||||||
result = val[0]
|
result = val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_58(val, _values, result)
|
def _reduce_58(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_59(val, _values, result)
|
def _reduce_59(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_60(val, _values, result)
|
def _reduce_60(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1009,7 +1010,7 @@ end
|
||||||
|
|
||||||
def _reduce_62(val, _values, result)
|
def _reduce_62(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1017,7 +1018,7 @@ end
|
||||||
|
|
||||||
def _reduce_64(val, _values, result)
|
def _reduce_64(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1048,7 +1049,7 @@ end
|
||||||
# reduce 77 omitted
|
# reduce 77 omitted
|
||||||
|
|
||||||
def _reduce_78(val, _values, result)
|
def _reduce_78(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1099,13 +1100,13 @@ end
|
||||||
def _reduce_101(val, _values, result)
|
def _reduce_101(val, _values, result)
|
||||||
index = @block_parser.add_footnote val[1].rdoc
|
index = @block_parser.add_footnote val[1].rdoc
|
||||||
result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]"
|
result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]"
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_102(val, _values, result)
|
def _reduce_102(val, _values, result)
|
||||||
result = inline "<tt>#{val[1]}</tt>", val[1]
|
result = inline "<tt>#{val[1]}</tt>", val[1]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1122,7 +1123,7 @@ end
|
||||||
# reduce 108 omitted
|
# reduce 108 omitted
|
||||||
|
|
||||||
def _reduce_109(val, _values, result)
|
def _reduce_109(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1130,24 +1131,24 @@ end
|
||||||
|
|
||||||
def _reduce_111(val, _values, result)
|
def _reduce_111(val, _values, result)
|
||||||
result = inline val[0]
|
result = inline val[0]
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
# reduce 112 omitted
|
# reduce 112 omitted
|
||||||
|
|
||||||
def _reduce_113(val, _values, result)
|
def _reduce_113(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_114(val, _values, result)
|
def _reduce_114(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def _reduce_115(val, _values, result)
|
def _reduce_115(val, _values, result)
|
||||||
result = val[1]
|
result = val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1192,7 +1193,7 @@ end
|
||||||
# reduce 135 omitted
|
# reduce 135 omitted
|
||||||
|
|
||||||
def _reduce_136(val, _values, result)
|
def _reduce_136(val, _values, result)
|
||||||
result << val[1]
|
result << val[1]
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -35,11 +35,6 @@ class RDoc::RDoc
|
||||||
|
|
||||||
GENERATORS = {}
|
GENERATORS = {}
|
||||||
|
|
||||||
##
|
|
||||||
# File pattern to exclude
|
|
||||||
|
|
||||||
attr_accessor :exclude
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Generator instance used for creating output
|
# Generator instance used for creating output
|
||||||
|
|
||||||
|
@ -93,7 +88,6 @@ class RDoc::RDoc
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@current = nil
|
@current = nil
|
||||||
@exclude = nil
|
|
||||||
@generator = nil
|
@generator = nil
|
||||||
@last_modified = {}
|
@last_modified = {}
|
||||||
@old_siginfo = nil
|
@old_siginfo = nil
|
||||||
|
@ -116,7 +110,7 @@ class RDoc::RDoc
|
||||||
def gather_files files
|
def gather_files files
|
||||||
files = ["."] if files.empty?
|
files = ["."] if files.empty?
|
||||||
|
|
||||||
file_list = normalized_file_list files, true, @exclude
|
file_list = normalized_file_list files, true, @options.exclude
|
||||||
|
|
||||||
file_list = file_list.uniq
|
file_list = file_list.uniq
|
||||||
|
|
||||||
|
@ -188,7 +182,7 @@ class RDoc::RDoc
|
||||||
error "#{dir} exists and is not a directory" unless File.directory? dir
|
error "#{dir} exists and is not a directory" unless File.directory? dir
|
||||||
|
|
||||||
begin
|
begin
|
||||||
open flag_file do |io|
|
File.open flag_file do |io|
|
||||||
unless force then
|
unless force then
|
||||||
Time.parse io.gets
|
Time.parse io.gets
|
||||||
|
|
||||||
|
@ -232,8 +226,11 @@ option)
|
||||||
|
|
||||||
def update_output_dir(op_dir, time, last = {})
|
def update_output_dir(op_dir, time, last = {})
|
||||||
return if @options.dry_run or not @options.update_output_dir
|
return if @options.dry_run or not @options.update_output_dir
|
||||||
|
unless ENV['SOURCE_DATE_EPOCH'].nil?
|
||||||
|
time = Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
|
||||||
|
end
|
||||||
|
|
||||||
open output_flag_file(op_dir), "w" do |f|
|
File.open output_flag_file(op_dir), "w" do |f|
|
||||||
f.puts time.rfc2822
|
f.puts time.rfc2822
|
||||||
last.each do |n, t|
|
last.each do |n, t|
|
||||||
f.puts "#{n}\t#{t.rfc2822}"
|
f.puts "#{n}\t#{t.rfc2822}"
|
||||||
|
@ -261,7 +258,7 @@ option)
|
||||||
|
|
||||||
patterns.split.each do |patt|
|
patterns.split.each do |patt|
|
||||||
candidates = Dir.glob(File.join(in_dir, patt))
|
candidates = Dir.glob(File.join(in_dir, patt))
|
||||||
result.concat normalized_file_list(candidates)
|
result.concat normalized_file_list(candidates, false, @options.exclude)
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
|
@ -469,8 +466,6 @@ The internal error was:
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
@exclude = @options.exclude
|
|
||||||
|
|
||||||
unless @options.coverage_report then
|
unless @options.coverage_report then
|
||||||
@last_modified = setup_output_dir @options.op_dir, @options.force_update
|
@last_modified = setup_output_dir @options.op_dir, @options.force_update
|
||||||
end
|
end
|
||||||
|
|
|
@ -110,7 +110,7 @@ class RDoc::RI::Driver
|
||||||
def self.dump data_path
|
def self.dump data_path
|
||||||
require 'pp'
|
require 'pp'
|
||||||
|
|
||||||
open data_path, 'rb' do |io|
|
File.open data_path, 'rb' do |io|
|
||||||
pp Marshal.load(io.read)
|
pp Marshal.load(io.read)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -425,6 +425,7 @@ or the PAGER environment variable.
|
||||||
@server = options[:server]
|
@server = options[:server]
|
||||||
@use_stdout = options[:use_stdout]
|
@use_stdout = options[:use_stdout]
|
||||||
@show_all = options[:show_all]
|
@show_all = options[:show_all]
|
||||||
|
@width = options[:width]
|
||||||
|
|
||||||
# pager process for jruby
|
# pager process for jruby
|
||||||
@jruby_pager_process = nil
|
@jruby_pager_process = nil
|
||||||
|
@ -795,7 +796,9 @@ or the PAGER environment variable.
|
||||||
|
|
||||||
def display document
|
def display document
|
||||||
page do |io|
|
page do |io|
|
||||||
text = document.accept formatter(io)
|
f = formatter(io)
|
||||||
|
f.width = @width if @width and f.respond_to?(:width)
|
||||||
|
text = document.accept f
|
||||||
|
|
||||||
io.write text
|
io.write text
|
||||||
end
|
end
|
||||||
|
@ -1440,7 +1443,13 @@ or the PAGER environment variable.
|
||||||
|
|
||||||
render_method_arguments out, method.arglists
|
render_method_arguments out, method.arglists
|
||||||
render_method_superclass out, method
|
render_method_superclass out, method
|
||||||
render_method_comment out, method
|
if method.is_alias_for
|
||||||
|
al = method.is_alias_for
|
||||||
|
alias_for = store.load_method al.parent_name, "#{al.name_prefix}#{al.name}"
|
||||||
|
render_method_comment out, method, alias_for
|
||||||
|
else
|
||||||
|
render_method_comment out, method
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_method_arguments out, arglists # :nodoc:
|
def render_method_arguments out, arglists # :nodoc:
|
||||||
|
@ -1452,10 +1461,22 @@ or the PAGER environment variable.
|
||||||
out << RDoc::Markup::Rule.new(1)
|
out << RDoc::Markup::Rule.new(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_method_comment out, method # :nodoc:
|
def render_method_comment out, method, alias_for = nil# :nodoc:
|
||||||
out << RDoc::Markup::BlankLine.new
|
if alias_for
|
||||||
out << method.comment
|
unless method.comment.nil? or method.comment.empty?
|
||||||
out << RDoc::Markup::BlankLine.new
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
out << method.comment
|
||||||
|
end
|
||||||
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
out << RDoc::Markup::Paragraph.new("(this method is alias for #{alias_for.full_name})")
|
||||||
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
out << alias_for.comment
|
||||||
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
else
|
||||||
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
out << method.comment
|
||||||
|
out << RDoc::Markup::BlankLine.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_method_superclass out, method # :nodoc:
|
def render_method_superclass out, method # :nodoc:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc'
|
require 'rdoc'
|
||||||
|
require 'erb'
|
||||||
require 'time'
|
require 'time'
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'webrick'
|
require 'webrick'
|
||||||
|
@ -111,7 +112,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
||||||
# GET request entry point. Fills in +res+ for the path, etc. in +req+.
|
# GET request entry point. Fills in +res+ for the path, etc. in +req+.
|
||||||
|
|
||||||
def do_GET req, res
|
def do_GET req, res
|
||||||
req.path = req.path.sub(/^#{Regexp.escape @mount_path}/o, '') if @mount_path
|
req.path.sub!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path
|
||||||
|
|
||||||
case req.path
|
case req.path
|
||||||
when '/' then
|
when '/' then
|
||||||
|
@ -427,14 +428,14 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
||||||
end
|
end
|
||||||
|
|
||||||
raise WEBrick::HTTPStatus::NotFound,
|
raise WEBrick::HTTPStatus::NotFound,
|
||||||
"Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
|
"Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir
|
||||||
|
|
||||||
store = RDoc::Store.new ri_dir, type
|
store = RDoc::Store.new ri_dir, type
|
||||||
|
|
||||||
return store if File.exist? store.cache_path
|
return store if File.exist? store.cache_path
|
||||||
|
|
||||||
raise WEBrick::HTTPStatus::NotFound,
|
raise WEBrick::HTTPStatus::NotFound,
|
||||||
"Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
|
"Could not find documentation for \"#{ERB::Util.html_escape(source_name)}\". Please run `gem rdoc --ri gem_name`"
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,6 +116,11 @@ class RDoc::Store
|
||||||
|
|
||||||
attr_accessor :encoding
|
attr_accessor :encoding
|
||||||
|
|
||||||
|
##
|
||||||
|
# The lazy constants alias will be discovered in passing
|
||||||
|
|
||||||
|
attr_reader :unmatched_constant_alias
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new Store of +type+ that will load or save to +path+
|
# Creates a new Store of +type+ that will load or save to +path+
|
||||||
|
|
||||||
|
@ -152,6 +157,8 @@ class RDoc::Store
|
||||||
|
|
||||||
@unique_classes = nil
|
@unique_classes = nil
|
||||||
@unique_modules = nil
|
@unique_modules = nil
|
||||||
|
|
||||||
|
@unmatched_constant_alias = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -539,7 +546,7 @@ class RDoc::Store
|
||||||
def load_cache
|
def load_cache
|
||||||
#orig_enc = @encoding
|
#orig_enc = @encoding
|
||||||
|
|
||||||
open cache_path, 'rb' do |io|
|
File.open cache_path, 'rb' do |io|
|
||||||
@cache = Marshal.load io.read
|
@cache = Marshal.load io.read
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -585,6 +592,8 @@ class RDoc::Store
|
||||||
case obj
|
case obj
|
||||||
when RDoc::NormalClass then
|
when RDoc::NormalClass then
|
||||||
@classes_hash[klass_name] = obj
|
@classes_hash[klass_name] = obj
|
||||||
|
when RDoc::SingleClass then
|
||||||
|
@classes_hash[klass_name] = obj
|
||||||
when RDoc::NormalModule then
|
when RDoc::NormalModule then
|
||||||
@modules_hash[klass_name] = obj
|
@modules_hash[klass_name] = obj
|
||||||
end
|
end
|
||||||
|
@ -596,7 +605,7 @@ class RDoc::Store
|
||||||
def load_class_data klass_name
|
def load_class_data klass_name
|
||||||
file = class_file klass_name
|
file = class_file klass_name
|
||||||
|
|
||||||
open file, 'rb' do |io|
|
File.open file, 'rb' do |io|
|
||||||
Marshal.load io.read
|
Marshal.load io.read
|
||||||
end
|
end
|
||||||
rescue Errno::ENOENT => e
|
rescue Errno::ENOENT => e
|
||||||
|
@ -611,7 +620,7 @@ class RDoc::Store
|
||||||
def load_method klass_name, method_name
|
def load_method klass_name, method_name
|
||||||
file = method_file klass_name, method_name
|
file = method_file klass_name, method_name
|
||||||
|
|
||||||
open file, 'rb' do |io|
|
File.open file, 'rb' do |io|
|
||||||
obj = Marshal.load io.read
|
obj = Marshal.load io.read
|
||||||
obj.store = self
|
obj.store = self
|
||||||
obj.parent =
|
obj.parent =
|
||||||
|
@ -631,7 +640,7 @@ class RDoc::Store
|
||||||
def load_page page_name
|
def load_page page_name
|
||||||
file = page_file page_name
|
file = page_file page_name
|
||||||
|
|
||||||
open file, 'rb' do |io|
|
File.open file, 'rb' do |io|
|
||||||
obj = Marshal.load io.read
|
obj = Marshal.load io.read
|
||||||
obj.store = self
|
obj.store = self
|
||||||
obj
|
obj
|
||||||
|
@ -778,7 +787,7 @@ class RDoc::Store
|
||||||
|
|
||||||
marshal = Marshal.dump @cache
|
marshal = Marshal.dump @cache
|
||||||
|
|
||||||
open cache_path, 'wb' do |io|
|
File.open cache_path, 'wb' do |io|
|
||||||
io.write marshal
|
io.write marshal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -854,7 +863,7 @@ class RDoc::Store
|
||||||
|
|
||||||
marshal = Marshal.dump klass
|
marshal = Marshal.dump klass
|
||||||
|
|
||||||
open path, 'wb' do |io|
|
File.open path, 'wb' do |io|
|
||||||
io.write marshal
|
io.write marshal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -879,7 +888,7 @@ class RDoc::Store
|
||||||
|
|
||||||
marshal = Marshal.dump method
|
marshal = Marshal.dump method
|
||||||
|
|
||||||
open method_file(full_name, method.full_name), 'wb' do |io|
|
File.open method_file(full_name, method.full_name), 'wb' do |io|
|
||||||
io.write marshal
|
io.write marshal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -901,7 +910,7 @@ class RDoc::Store
|
||||||
|
|
||||||
marshal = Marshal.dump page
|
marshal = Marshal.dump page
|
||||||
|
|
||||||
open path, 'wb' do |io|
|
File.open path, 'wb' do |io|
|
||||||
io.write marshal
|
io.write marshal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -169,7 +169,7 @@ module RDoc::Text
|
||||||
|
|
||||||
encoding = text.encoding
|
encoding = text.encoding
|
||||||
|
|
||||||
text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
|
text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+-/*\%@`\[\]]+%, ''
|
||||||
|
|
||||||
space = ' '
|
space = ' '
|
||||||
space = RDoc::Encoding.change_encoding space, encoding if encoding
|
space = RDoc::Encoding.change_encoding space, encoding if encoding
|
||||||
|
|
|
@ -107,7 +107,7 @@ module RDoc::TokenStream
|
||||||
# Returns a string representation of the token stream
|
# Returns a string representation of the token stream
|
||||||
|
|
||||||
def tokens_to_s
|
def tokens_to_s
|
||||||
token_stream.compact.map { |token| token.text }.join ''
|
token_stream.compact.map { |token| token[:text] }.join ''
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
begin
|
begin
|
||||||
gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
|
gem 'minitest', '~> 5.0'
|
||||||
rescue NoMethodError, Gem::LoadError
|
rescue NoMethodError, Gem::LoadError
|
||||||
# for ruby tests
|
# for ruby tests
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ require 'rdoc'
|
||||||
# * <code>@pwd</code> containing the current working directory
|
# * <code>@pwd</code> containing the current working directory
|
||||||
# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO
|
# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO
|
||||||
|
|
||||||
class RDoc::TestCase < MiniTest::Unit::TestCase
|
class RDoc::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase)
|
||||||
|
|
||||||
##
|
##
|
||||||
# Abstract test-case setup
|
# Abstract test-case setup
|
|
@ -133,7 +133,7 @@ method(a, b) { |c, d| ... }
|
||||||
assert_equal 'Klass#method', loaded.full_name
|
assert_equal 'Klass#method', loaded.full_name
|
||||||
assert_equal 'method', loaded.name
|
assert_equal 'method', loaded.name
|
||||||
assert_equal 'param', loaded.params
|
assert_equal 'param', loaded.params
|
||||||
assert_equal nil, loaded.singleton # defaults to nil
|
assert_nil loaded.singleton # defaults to nil
|
||||||
assert_equal :public, loaded.visibility
|
assert_equal :public, loaded.visibility
|
||||||
assert_equal cm, loaded.parent
|
assert_equal cm, loaded.parent
|
||||||
assert_equal section, loaded.section
|
assert_equal section, loaded.section
|
||||||
|
@ -151,6 +151,19 @@ method(a, b) { |c, d| ... }
|
||||||
assert aliased_method.display?
|
assert aliased_method.display?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_marshal_load_aliased_method_with_nil_singleton
|
||||||
|
aliased_method = Marshal.load Marshal.dump(@c2_a)
|
||||||
|
|
||||||
|
aliased_method.store = @store
|
||||||
|
aliased_method.is_alias_for = ["C2", nil, "b"]
|
||||||
|
|
||||||
|
assert_equal 'C2#a', aliased_method.full_name
|
||||||
|
assert_equal 'C2', aliased_method.parent_name
|
||||||
|
assert_equal '()', aliased_method.params
|
||||||
|
assert_equal @c2_b, aliased_method.is_alias_for, 'is_alias_for'
|
||||||
|
assert aliased_method.display?
|
||||||
|
end
|
||||||
|
|
||||||
def test_marshal_load_class_method
|
def test_marshal_load_class_method
|
||||||
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
|
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
|
||||||
|
|
||||||
|
@ -207,9 +220,9 @@ method(a, b) { |c, d| ... }
|
||||||
assert_equal 'Klass#method', loaded.full_name
|
assert_equal 'Klass#method', loaded.full_name
|
||||||
assert_equal 'method', loaded.name
|
assert_equal 'method', loaded.name
|
||||||
assert_equal 'param', loaded.params
|
assert_equal 'param', loaded.params
|
||||||
assert_equal nil, loaded.singleton # defaults to nil
|
assert_nil loaded.singleton # defaults to nil
|
||||||
assert_equal :public, loaded.visibility
|
assert_equal :public, loaded.visibility
|
||||||
assert_equal nil, loaded.file
|
assert_nil loaded.file
|
||||||
assert_equal cm, loaded.parent
|
assert_equal cm, loaded.parent
|
||||||
assert_equal section, loaded.section
|
assert_equal section, loaded.section
|
||||||
assert_nil loaded.is_alias_for
|
assert_nil loaded.is_alias_for
|
||||||
|
@ -264,7 +277,7 @@ method(a, b) { |c, d| ... }
|
||||||
assert_equal 'Klass#method', loaded.full_name
|
assert_equal 'Klass#method', loaded.full_name
|
||||||
assert_equal 'method', loaded.name
|
assert_equal 'method', loaded.name
|
||||||
assert_equal 'param', loaded.params
|
assert_equal 'param', loaded.params
|
||||||
assert_equal nil, loaded.singleton # defaults to nil
|
assert_nil loaded.singleton # defaults to nil
|
||||||
assert_equal :public, loaded.visibility
|
assert_equal :public, loaded.visibility
|
||||||
assert_equal cm, loaded.parent
|
assert_equal cm, loaded.parent
|
||||||
assert_equal section, loaded.section
|
assert_equal section, loaded.section
|
||||||
|
@ -467,4 +480,3 @@ method(a, b) { |c, d| ... }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocAttr < RDoc::TestCase
|
class TestRDocAttr < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class TestRDocAttr < RDoc::TestCase
|
||||||
assert_equal cm, loaded.parent
|
assert_equal cm, loaded.parent
|
||||||
assert_equal section, loaded.section
|
assert_equal section, loaded.section
|
||||||
|
|
||||||
assert loaded.display?
|
assert loaded.display?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_marshal_load_version_2
|
def test_marshal_load_version_2
|
||||||
|
@ -188,4 +188,3 @@ class TestRDocAttr < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1277,7 +1277,8 @@ class TestRDocClassModule < XrefTestCase
|
||||||
n1 = @xref_data.add_module RDoc::NormalClass, 'N1'
|
n1 = @xref_data.add_module RDoc::NormalClass, 'N1'
|
||||||
n1_k2 = n1.add_module RDoc::NormalClass, 'N2'
|
n1_k2 = n1.add_module RDoc::NormalClass, 'N2'
|
||||||
|
|
||||||
n1.add_module_alias n1_k2, 'A1', @xref_data
|
a1 = RDoc::Constant.new 'A1', '', ''
|
||||||
|
n1.add_module_alias n1_k2, n1_k2.name, a1, @xref_data
|
||||||
|
|
||||||
n1_a1_c = n1.constants.find { |c| c.name == 'A1' }
|
n1_a1_c = n1.constants.find { |c| c.name == 'A1' }
|
||||||
refute_nil n1_a1_c
|
refute_nil n1_a1_c
|
||||||
|
@ -1301,7 +1302,8 @@ class TestRDocClassModule < XrefTestCase
|
||||||
n1 = @xref_data.add_module RDoc::NormalModule, 'N1'
|
n1 = @xref_data.add_module RDoc::NormalModule, 'N1'
|
||||||
n1_n2 = n1.add_module RDoc::NormalModule, 'N2'
|
n1_n2 = n1.add_module RDoc::NormalModule, 'N2'
|
||||||
|
|
||||||
n1.add_module_alias n1_n2, 'A1', @xref_data
|
a1 = RDoc::Constant.new 'A1', '', ''
|
||||||
|
n1.add_module_alias n1_n2, n1_n2.name, a1, @xref_data
|
||||||
|
|
||||||
n1_a1_c = n1.constants.find { |c| c.name == 'A1' }
|
n1_a1_c = n1.constants.find { |c| c.name == 'A1' }
|
||||||
refute_nil n1_a1_c
|
refute_nil n1_a1_c
|
||||||
|
@ -1326,7 +1328,8 @@ class TestRDocClassModule < XrefTestCase
|
||||||
l1_l2 = l1.add_module RDoc::NormalModule, 'L2'
|
l1_l2 = l1.add_module RDoc::NormalModule, 'L2'
|
||||||
o1 = @xref_data.add_module RDoc::NormalModule, 'O1'
|
o1 = @xref_data.add_module RDoc::NormalModule, 'O1'
|
||||||
|
|
||||||
o1.add_module_alias l1_l2, 'A1', @xref_data
|
a1 = RDoc::Constant.new 'A1', '', ''
|
||||||
|
o1.add_module_alias l1_l2, l1_l2.name, a1, @xref_data
|
||||||
|
|
||||||
o1_a1_c = o1.constants.find { |c| c.name == 'A1' }
|
o1_a1_c = o1.constants.find { |c| c.name == 'A1' }
|
||||||
refute_nil o1_a1_c
|
refute_nil o1_a1_c
|
||||||
|
@ -1358,7 +1361,8 @@ class TestRDocClassModule < XrefTestCase
|
||||||
const.record_location top_level
|
const.record_location top_level
|
||||||
const.is_alias_for = klass
|
const.is_alias_for = klass
|
||||||
|
|
||||||
top_level.add_module_alias klass, 'A', top_level
|
a = RDoc::Constant.new 'A', '', ''
|
||||||
|
top_level.add_module_alias klass, klass.name, a, top_level
|
||||||
|
|
||||||
object.add_constant const
|
object.add_constant const
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ class TestRDocCodeObject < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_file_name
|
def test_file_name
|
||||||
assert_equal nil, @co.file_name
|
assert_nil @co.file_name
|
||||||
|
|
||||||
@co.record_location @store.add_file 'lib/file.rb'
|
@co.record_location @store.add_file 'lib/file.rb'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: us-ascii
|
# coding: us-ascii
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocComment < RDoc::TestCase
|
class TestRDocComment < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ call-seq:
|
||||||
|
|
||||||
comment.extract_call_seq m
|
comment.extract_call_seq m
|
||||||
|
|
||||||
assert_equal nil, m.call_seq
|
assert_nil m.call_seq
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_extract_call_seq_no_blank
|
def test_extract_call_seq_no_blank
|
||||||
|
|
|
@ -118,7 +118,7 @@ class TestRDocConstant < XrefTestCase
|
||||||
assert_equal cm, loaded.parent
|
assert_equal cm, loaded.parent
|
||||||
assert_equal section, loaded.section
|
assert_equal section, loaded.section
|
||||||
|
|
||||||
assert loaded.display?
|
assert loaded.display?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_marshal_load_version_0
|
def test_marshal_load_version_0
|
||||||
|
|
|
@ -14,10 +14,10 @@ class TestRDocContext < XrefTestCase
|
||||||
assert_empty @context.in_files
|
assert_empty @context.in_files
|
||||||
assert_equal 'unknown', @context.name
|
assert_equal 'unknown', @context.name
|
||||||
assert_equal '', @context.comment
|
assert_equal '', @context.comment
|
||||||
assert_equal nil, @context.parent
|
assert_nil @context.parent
|
||||||
assert_equal :public, @context.visibility
|
assert_equal :public, @context.visibility
|
||||||
assert_equal 1, @context.sections.length
|
assert_equal 1, @context.sections.length
|
||||||
assert_equal nil, @context.temporary_section
|
assert_nil @context.temporary_section
|
||||||
|
|
||||||
assert_empty @context.classes_hash
|
assert_empty @context.classes_hash
|
||||||
assert_empty @context.modules_hash
|
assert_empty @context.modules_hash
|
||||||
|
@ -280,7 +280,8 @@ class TestRDocContext < XrefTestCase
|
||||||
def test_add_module_alias
|
def test_add_module_alias
|
||||||
tl = @store.add_file 'file.rb'
|
tl = @store.add_file 'file.rb'
|
||||||
|
|
||||||
c3_c4 = @c2.add_module_alias @c2_c3, 'C4', tl
|
c4 = RDoc::Constant.new 'C4', '', ''
|
||||||
|
c3_c4 = @c2.add_module_alias @c2_c3, @c2_c3.name, c4, tl
|
||||||
|
|
||||||
alias_constant = @c2.constants.first
|
alias_constant = @c2.constants.first
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ class TestRDocContext < XrefTestCase
|
||||||
|
|
||||||
object = top_level.add_class RDoc::NormalClass, 'Object'
|
object = top_level.add_class RDoc::NormalClass, 'Object'
|
||||||
|
|
||||||
top_level.add_module_alias klass, 'A', top_level
|
a = RDoc::Constant.new 'A', '', ''
|
||||||
|
top_level.add_module_alias klass, klass.name, a, top_level
|
||||||
|
|
||||||
refute_empty object.constants
|
refute_empty object.constants
|
||||||
|
|
||||||
|
@ -512,7 +514,7 @@ class TestRDocContext < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_attribute_named
|
def test_find_attribute_named
|
||||||
assert_equal nil, @c1.find_attribute_named('none')
|
assert_nil @c1.find_attribute_named('none')
|
||||||
assert_equal 'R', @c1.find_attribute_named('attr').rw
|
assert_equal 'R', @c1.find_attribute_named('attr').rw
|
||||||
assert_equal 'R', @c1.find_attribute_named('attr_reader').rw
|
assert_equal 'R', @c1.find_attribute_named('attr_reader').rw
|
||||||
assert_equal 'W', @c1.find_attribute_named('attr_writer').rw
|
assert_equal 'W', @c1.find_attribute_named('attr_writer').rw
|
||||||
|
@ -520,7 +522,7 @@ class TestRDocContext < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_class_method_named
|
def test_find_class_method_named
|
||||||
assert_equal nil, @c1.find_class_method_named('none')
|
assert_nil @c1.find_class_method_named('none')
|
||||||
|
|
||||||
m = @c1.find_class_method_named('m')
|
m = @c1.find_class_method_named('m')
|
||||||
assert_instance_of RDoc::AnyMethod, m
|
assert_instance_of RDoc::AnyMethod, m
|
||||||
|
@ -528,23 +530,23 @@ class TestRDocContext < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_constant_named
|
def test_find_constant_named
|
||||||
assert_equal nil, @c1.find_constant_named('NONE')
|
assert_nil @c1.find_constant_named('NONE')
|
||||||
assert_equal ':const', @c1.find_constant_named('CONST').value
|
assert_equal ':const', @c1.find_constant_named('CONST').value
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_enclosing_module_named
|
def test_find_enclosing_module_named
|
||||||
assert_equal nil, @c2_c3.find_enclosing_module_named('NONE')
|
assert_nil @c2_c3.find_enclosing_module_named('NONE')
|
||||||
assert_equal @c1, @c2_c3.find_enclosing_module_named('C1')
|
assert_equal @c1, @c2_c3.find_enclosing_module_named('C1')
|
||||||
assert_equal @c2, @c2_c3.find_enclosing_module_named('C2')
|
assert_equal @c2, @c2_c3.find_enclosing_module_named('C2')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_file_named
|
def test_find_file_named
|
||||||
assert_equal nil, @c1.find_file_named('nonexistent.rb')
|
assert_nil @c1.find_file_named('nonexistent.rb')
|
||||||
assert_equal @xref_data, @c1.find_file_named(@file_name)
|
assert_equal @xref_data, @c1.find_file_named(@file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_instance_method_named
|
def test_find_instance_method_named
|
||||||
assert_equal nil, @c1.find_instance_method_named('none')
|
assert_nil @c1.find_instance_method_named('none')
|
||||||
|
|
||||||
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
|
||||||
|
@ -559,6 +561,14 @@ class TestRDocContext < XrefTestCase
|
||||||
assert_equal @c2_c3, @c2.find_local_symbol('C3')
|
assert_equal @c2_c3, @c2.find_local_symbol('C3')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_method
|
||||||
|
loaded_c2 = Marshal.load Marshal.dump @c2
|
||||||
|
assert_equal @c2_a, loaded_c2.find_method('a', false)
|
||||||
|
assert_equal @c2_b, loaded_c2.find_method('b', false)
|
||||||
|
assert_equal @c2_a, loaded_c2.find_method('a', nil)
|
||||||
|
assert_equal @c2_b, loaded_c2.find_method('b', nil)
|
||||||
|
end
|
||||||
|
|
||||||
def test_find_method_named
|
def test_find_method_named
|
||||||
assert_equal true, @c1.find_method_named('m').singleton
|
assert_equal true, @c1.find_method_named('m').singleton
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocContextSection < RDoc::TestCase
|
class TestRDocContextSection < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: US-ASCII
|
# coding: US-ASCII
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocEncoding < RDoc::TestCase
|
class TestRDocEncoding < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class TestRDocEncoding < RDoc::TestCase
|
||||||
@tempfile.flush
|
@tempfile.flush
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
||||||
assert_equal "hi everybody", contents
|
assert_equal "# coding: utf-8\nhi everybody", contents
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
assert_equal Encoding::UTF_8, contents.encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class TestRDocEncoding < RDoc::TestCase
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
assert_equal Encoding::UTF_8, contents.encoding
|
||||||
assert_equal "hi \u00e9verybody", contents.sub("\r", '')
|
assert_equal "# coding: ISO-8859-1\nhi \u00e9verybody", contents.sub("\r", '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_class_read_file_encoding_fail
|
def test_class_read_file_encoding_fail
|
||||||
|
@ -65,13 +65,13 @@ class TestRDocEncoding < RDoc::TestCase
|
||||||
|
|
||||||
def test_class_read_file_encoding_fancy
|
def test_class_read_file_encoding_fancy
|
||||||
expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody"
|
expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody"
|
||||||
exptected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
||||||
|
|
||||||
@tempfile.write expected
|
@tempfile.write expected
|
||||||
@tempfile.flush
|
@tempfile.flush
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
||||||
assert_equal "hi everybody", contents
|
assert_equal "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody", contents
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
assert_equal Encoding::UTF_8, contents.encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class TestRDocEncoding < RDoc::TestCase
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII, true
|
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII, true
|
||||||
|
|
||||||
assert_equal '?', contents
|
assert_equal "# coding: utf-8\n?", contents
|
||||||
assert_equal Encoding::US_ASCII, contents.encoding
|
assert_equal Encoding::US_ASCII, contents.encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -124,108 +124,58 @@ class TestRDocEncoding < RDoc::TestCase
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
||||||
|
|
||||||
expected = ":\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:"
|
expected = "# coding: ISO-2022-JP\n:\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:"
|
||||||
expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8
|
||||||
|
|
||||||
assert_equal expected, contents
|
assert_equal expected, contents
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
assert_equal Encoding::UTF_8, contents.encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_class_set_encoding
|
def test_class_detect_encoding
|
||||||
s = "# coding: UTF-8\n"
|
s = "# coding: UTF-8\n"
|
||||||
s = RDoc::Encoding.set_encoding s
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
|
|
||||||
# sanity check for 1.8
|
# sanity check for 1.8
|
||||||
|
|
||||||
assert_equal Encoding::UTF_8, s.encoding
|
assert_equal Encoding::UTF_8, encoding
|
||||||
|
|
||||||
s = "#!/bin/ruby\n# coding: UTF-8\n"
|
s = "#!/bin/ruby\n# coding: UTF-8\n"
|
||||||
s = RDoc::Encoding.set_encoding s
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
|
|
||||||
assert_equal Encoding::UTF_8, s.encoding
|
assert_equal Encoding::UTF_8, encoding
|
||||||
|
|
||||||
s = "<?xml version='1.0' encoding='UTF-8'?>\n"
|
s = "<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||||
s = RDoc::Encoding.set_encoding s
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
|
|
||||||
assert_equal Encoding::UTF_8, s.encoding
|
assert_equal Encoding::UTF_8, encoding
|
||||||
|
|
||||||
s = "<?xml version='1.0' encoding=\"UTF-8\"?>\n"
|
s = "<?xml version='1.0' encoding=\"UTF-8\"?>\n"
|
||||||
s = RDoc::Encoding.set_encoding s
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
|
|
||||||
assert_equal Encoding::UTF_8, s.encoding
|
assert_equal Encoding::UTF_8, encoding
|
||||||
end
|
|
||||||
|
|
||||||
def test_class_set_encoding_strip
|
|
||||||
s = "# coding: UTF-8\n# more comments"
|
|
||||||
|
|
||||||
s = RDoc::Encoding.set_encoding s
|
|
||||||
|
|
||||||
assert_equal "# more comments", s
|
|
||||||
|
|
||||||
s = "#!/bin/ruby\n# coding: UTF-8\n# more comments"
|
|
||||||
|
|
||||||
s = RDoc::Encoding.set_encoding s
|
|
||||||
|
|
||||||
assert_equal "#!/bin/ruby\n# more comments", s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_class_set_encoding_bad
|
def test_class_set_encoding_bad
|
||||||
s = ""
|
s = ""
|
||||||
expected = s.encoding
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
s = RDoc::Encoding.set_encoding s
|
|
||||||
|
|
||||||
assert_equal expected, s.encoding
|
assert_nil encoding
|
||||||
|
|
||||||
s = "# vim:set fileencoding=utf-8:\n"
|
s = "# vim:set fileencoding=utf-8:\n"
|
||||||
expected = s.encoding
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
s = RDoc::Encoding.set_encoding s
|
|
||||||
|
|
||||||
assert_equal expected, s.encoding
|
assert_nil encoding
|
||||||
|
|
||||||
s = "# vim:set fileencoding=utf-8:\n"
|
s = "# vim:set fileencoding=utf-8:\n"
|
||||||
expected = s.encoding
|
encoding = RDoc::Encoding.detect_encoding s
|
||||||
s = RDoc::Encoding.set_encoding s
|
|
||||||
|
|
||||||
assert_equal expected, s.encoding
|
assert_nil encoding
|
||||||
|
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
s = RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n"
|
s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_skip_frozen_string_literal
|
|
||||||
expected = "# frozen_string_literal: true\nhi everybody"
|
|
||||||
|
|
||||||
@tempfile.write expected
|
|
||||||
@tempfile.flush
|
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
|
||||||
assert_equal "hi everybody", contents
|
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_skip_frozen_string_literal_after_coding
|
|
||||||
expected = "# coding: utf-8\n# frozen-string-literal: false\nhi everybody"
|
|
||||||
|
|
||||||
@tempfile.write expected
|
|
||||||
@tempfile.flush
|
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
|
||||||
assert_equal "hi everybody", contents
|
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_skip_frozen_string_literal_before_coding
|
|
||||||
expected = "# frozen_string_literal: true\n# coding: utf-8\nhi everybody"
|
|
||||||
|
|
||||||
@tempfile.write expected
|
|
||||||
@tempfile.flush
|
|
||||||
|
|
||||||
contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
|
|
||||||
assert_equal "hi everybody", contents
|
|
||||||
assert_equal Encoding::UTF_8, contents.encoding
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_sanity
|
def test_sanity
|
||||||
assert_equal Encoding::US_ASCII, ''.encoding,
|
assert_equal Encoding::US_ASCII, ''.encoding,
|
||||||
'If this file is not ASCII tests may incorrectly pass'
|
'If this file is not ASCII tests may incorrectly pass'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorDarkfish < RDoc::TestCase
|
class TestRDocGeneratorDarkfish < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
|
||||||
|
|
||||||
@top_level.add_constant @alias_constant
|
@top_level.add_constant @alias_constant
|
||||||
|
|
||||||
@klass.add_module_alias @klass, 'A', @top_level
|
@klass.add_module_alias @klass, @klass.name, @alias_constant, @top_level
|
||||||
|
|
||||||
@meth = RDoc::AnyMethod.new nil, 'method'
|
@meth = RDoc::AnyMethod.new nil, 'method'
|
||||||
@meth_bang = RDoc::AnyMethod.new nil, 'method!'
|
@meth_bang = RDoc::AnyMethod.new nil, 'method!'
|
||||||
|
@ -135,7 +135,7 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_install_rdoc_static_file
|
def test_install_rdoc_static_file
|
||||||
src = Pathname(__FILE__)
|
src = Pathname File.expand_path(__FILE__, @pwd)
|
||||||
dst = File.join @tmpdir, File.basename(src)
|
dst = File.join @tmpdir, File.basename(src)
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# coding: US-ASCII
|
# coding: US-ASCII
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorJsonIndex < RDoc::TestCase
|
class TestRDocGeneratorJsonIndex < RDoc::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|
||||||
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_darkfish_#{$$}"
|
@tmpdir = Dir.mktmpdir "test_rdoc_generator_darkfish_#{$$}_"
|
||||||
FileUtils.mkdir_p @tmpdir
|
FileUtils.mkdir_p @tmpdir
|
||||||
|
|
||||||
@options = RDoc::Options.new
|
@options = RDoc::Options.new
|
||||||
|
@ -89,12 +89,31 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generate
|
def test_generate
|
||||||
|
now = Time.now
|
||||||
@g.generate
|
@g.generate
|
||||||
|
|
||||||
assert_file 'js/searcher.js'
|
assert_file 'js/searcher.js'
|
||||||
assert_file 'js/navigation.js'
|
assert_file 'js/navigation.js'
|
||||||
assert_file 'js/search_index.js'
|
assert_file 'js/search_index.js'
|
||||||
|
|
||||||
|
srcdir = File.expand_path("../../lib/rdoc", __FILE__)
|
||||||
|
if !File.directory? srcdir
|
||||||
|
# for Ruby core repository
|
||||||
|
srcdir = File.expand_path("../../../lib/rdoc", __FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
orig_file = Pathname(File.join srcdir, 'generator/template/json_index/js/navigation.js')
|
||||||
|
generated_file = Pathname(File.join @tmpdir, 'js/navigation.js')
|
||||||
|
|
||||||
|
# This is dirty hack on JRuby for MiniTest 4
|
||||||
|
assert orig_file.mtime.inspect == generated_file.mtime.inspect,
|
||||||
|
'.js files should be tha same timestamp of original'
|
||||||
|
|
||||||
|
assert generated_file.mtime < now, '.js files should be the same timestamp'
|
||||||
|
|
||||||
|
generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js')
|
||||||
|
assert generated_search_index.mtime > (now - 1), 'search_index.js should be generated timestamp'
|
||||||
|
|
||||||
json = File.read 'js/search_index.js'
|
json = File.read 'js/search_index.js'
|
||||||
|
|
||||||
json =~ /\Avar search_data = /
|
json =~ /\Avar search_data = /
|
||||||
|
@ -137,6 +156,20 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
|
||||||
assert_equal expected, index
|
assert_equal expected, index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_generate_search_index_with_reproducible_builds
|
||||||
|
backup_epoch = ENV['SOURCE_DATE_EPOCH']
|
||||||
|
ruby_birthday = Time.parse 'Wed, 24 Feb 1993 21:00:00 +0900'
|
||||||
|
ENV['SOURCE_DATE_EPOCH'] = ruby_birthday.to_i.to_s
|
||||||
|
|
||||||
|
@g.generate
|
||||||
|
|
||||||
|
assert_file 'js/search_index.js'
|
||||||
|
generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js')
|
||||||
|
assert_equal ruby_birthday, generated_search_index.mtime
|
||||||
|
|
||||||
|
ENV['SOURCE_DATE_EPOCH'] = backup_epoch
|
||||||
|
end
|
||||||
|
|
||||||
def test_generate_gzipped
|
def test_generate_gzipped
|
||||||
begin
|
begin
|
||||||
require 'zlib'
|
require 'zlib'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorMarkup < RDoc::TestCase
|
class TestRDocGeneratorMarkup < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorPOT < RDoc::TestCase
|
class TestRDocGeneratorPOT < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorPOTPO < RDoc::TestCase
|
class TestRDocGeneratorPOTPO < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorPOTPOEntry < RDoc::TestCase
|
class TestRDocGeneratorPOTPOEntry < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocGeneratorRI < RDoc::TestCase
|
class TestRDocGeneratorRI < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocI18nLocale < RDoc::TestCase
|
class TestRDocI18nLocale < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocI18nText < RDoc::TestCase
|
class TestRDocI18nText < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: UTF-8
|
# coding: UTF-8
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
require 'rdoc/markup/block_quote'
|
require 'rdoc/markup/block_quote'
|
||||||
require 'rdoc/markdown'
|
require 'rdoc/markdown'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkup < RDoc::TestCase
|
class TestRDocMarkup < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupAttributeManager < RDoc::TestCase
|
class TestRDocMarkupAttributeManager < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupAttributes < RDoc::TestCase
|
class TestRDocMarkupAttributes < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupDocument < RDoc::TestCase
|
class TestRDocMarkupDocument < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupFormatter < RDoc::TestCase
|
class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -111,15 +111,15 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
assert_equal 'http', scheme
|
assert_equal 'http', scheme
|
||||||
assert_equal 'example/foo', url
|
assert_equal 'example/foo', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_url_anchor
|
def test_parse_url_anchor
|
||||||
scheme, url, id = @to.parse_url '#foottext-1'
|
scheme, url, id = @to.parse_url '#foottext-1'
|
||||||
|
|
||||||
assert_equal nil, scheme
|
assert_nil scheme
|
||||||
assert_equal '#foottext-1', url
|
assert_equal '#foottext-1', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_url_link
|
def test_parse_url_link
|
||||||
|
@ -127,7 +127,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
assert_equal 'link', scheme
|
assert_equal 'link', scheme
|
||||||
assert_equal 'README.txt', url
|
assert_equal 'README.txt', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_url_link_id
|
def test_parse_url_link_id
|
||||||
|
@ -135,7 +135,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
assert_equal 'link', scheme
|
assert_equal 'link', scheme
|
||||||
assert_equal 'README.txt#label-foo', url
|
assert_equal 'README.txt#label-foo', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_url_rdoc_label
|
def test_parse_url_rdoc_label
|
||||||
|
@ -143,7 +143,7 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
assert_equal 'link', scheme
|
assert_equal 'link', scheme
|
||||||
assert_equal '#foo', url
|
assert_equal '#foo', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
|
|
||||||
scheme, url, id = @to.parse_url 'rdoc-label:foo:bar'
|
scheme, url, id = @to.parse_url 'rdoc-label:foo:bar'
|
||||||
|
|
||||||
|
@ -157,13 +157,13 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
|
|
||||||
assert_equal 'http', scheme
|
assert_equal 'http', scheme
|
||||||
assert_equal 'http://example/foo', url
|
assert_equal 'http://example/foo', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
|
|
||||||
scheme, url, id = @to.parse_url 'https://example/foo'
|
scheme, url, id = @to.parse_url 'https://example/foo'
|
||||||
|
|
||||||
assert_equal 'https', scheme
|
assert_equal 'https', scheme
|
||||||
assert_equal 'https://example/foo', url
|
assert_equal 'https://example/foo', url
|
||||||
assert_equal nil, id
|
assert_nil id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_convert_tt_special
|
def test_convert_tt_special
|
||||||
|
@ -173,4 +173,3 @@ class TestRDocMarkupFormatter < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupHardBreak < RDoc::TestCase
|
class TestRDocMarkupHardBreak < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupHeading < RDoc::TestCase
|
class TestRDocMarkupHeading < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupInclude < RDoc::TestCase
|
class TestRDocMarkupInclude < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupIndentedParagraph < RDoc::TestCase
|
class TestRDocMarkupIndentedParagraph < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupParagraph < RDoc::TestCase
|
class TestRDocMarkupParagraph < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupParser < RDoc::TestCase
|
class TestRDocMarkupParser < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -1068,7 +1068,7 @@ the time
|
||||||
|
|
||||||
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
|
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
|
||||||
|
|
||||||
assert_equal nil, parser.skip(:NONE, false)
|
assert_nil parser.skip(:NONE, false)
|
||||||
|
|
||||||
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
|
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupPreProcess < RDoc::TestCase
|
class TestRDocMarkupPreProcess < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupRaw < RDoc::TestCase
|
class TestRDocMarkupRaw < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
|
class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
|
class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
|
class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToJoinedParagraph < RDoc::TestCase
|
class TestRDocMarkupToJoinedParagraph < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase
|
class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase
|
class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
|
class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase
|
class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
|
class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocMarkupVerbatim < RDoc::TestCase
|
class TestRDocMarkupVerbatim < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocOptions < RDoc::TestCase
|
class TestRDocOptions < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ class TestRDocOptions < RDoc::TestCase
|
||||||
|
|
||||||
def test_check_files
|
def test_check_files
|
||||||
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
|
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
skip "skipped in root privilege" if Process.uid == 0
|
|
||||||
|
|
||||||
out, err = capture_io do
|
out, err = capture_io do
|
||||||
temp_dir do
|
temp_dir do
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: us-ascii -*-
|
# -*- coding: us-ascii -*-
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParser < RDoc::TestCase
|
class TestRDocParser < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_class_binary_eh_ISO_2022_JP
|
def test_class_binary_eh_ISO_2022_JP
|
||||||
iso_2022_jp = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.rd"
|
iso_2022_jp = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.rd"
|
||||||
|
|
||||||
open iso_2022_jp, 'wb' do |io|
|
File.open iso_2022_jp, 'wb' do |io|
|
||||||
io.write "# coding: ISO-2022-JP\n"
|
io.write "# coding: ISO-2022-JP\n"
|
||||||
io.write ":\e$B%3%^%s%I\e(B:\n"
|
io.write ":\e$B%3%^%s%I\e(B:\n"
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
|
|
||||||
def test_class_binary_eh_marshal
|
def test_class_binary_eh_marshal
|
||||||
marshal = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.marshal"
|
marshal = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.marshal"
|
||||||
open marshal, 'wb' do |io|
|
File.open marshal, 'wb' do |io|
|
||||||
io.write Marshal.dump('')
|
io.write Marshal.dump('')
|
||||||
io.write 'lots of text ' * 500
|
io.write 'lots of text ' * 500
|
||||||
end
|
end
|
||||||
|
@ -92,7 +92,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_class_for_executable
|
def test_class_for_executable
|
||||||
temp_dir do
|
temp_dir do
|
||||||
content = "#!/usr/bin/env ruby -w\n"
|
content = "#!/usr/bin/env ruby -w\n"
|
||||||
open 'app', 'w' do |io| io.write content end
|
File.open 'app', 'w' do |io| io.write content end
|
||||||
app = @store.add_file 'app'
|
app = @store.add_file 'app'
|
||||||
|
|
||||||
parser = @RP.for app, 'app', content, @options, :stats
|
parser = @RP.for app, 'app', content, @options, :stats
|
||||||
|
@ -126,7 +126,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
temp_dir do
|
temp_dir do
|
||||||
content = "# -*- rdoc -*-\n= NEWS\n"
|
content = "# -*- rdoc -*-\n= NEWS\n"
|
||||||
|
|
||||||
open 'NEWS', 'w' do |io| io.write content end
|
File.open 'NEWS', 'w' do |io| io.write content end
|
||||||
app = @store.add_file 'NEWS'
|
app = @store.add_file 'NEWS'
|
||||||
|
|
||||||
parser = @RP.for app, 'NEWS', content, @options, :stats
|
parser = @RP.for app, 'NEWS', content, @options, :stats
|
||||||
|
@ -140,7 +140,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_can_parse_modeline
|
def test_can_parse_modeline
|
||||||
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
||||||
|
|
||||||
open readme_ext, 'w' do |io|
|
File.open readme_ext, 'w' do |io|
|
||||||
io.puts "# README.EXT - -*- rdoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
|
io.puts "# README.EXT - -*- rdoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
|
||||||
io.puts
|
io.puts
|
||||||
io.puts "This document explains how to make extension libraries for Ruby."
|
io.puts "This document explains how to make extension libraries for Ruby."
|
||||||
|
@ -162,7 +162,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_check_modeline
|
def test_check_modeline
|
||||||
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
||||||
|
|
||||||
open readme_ext, 'w' do |io|
|
File.open readme_ext, 'w' do |io|
|
||||||
io.puts "# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
|
io.puts "# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
|
||||||
io.puts
|
io.puts
|
||||||
io.puts "This document explains how to make extension libraries for Ruby."
|
io.puts "This document explains how to make extension libraries for Ruby."
|
||||||
|
@ -176,7 +176,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_check_modeline_coding
|
def test_check_modeline_coding
|
||||||
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
||||||
|
|
||||||
open readme_ext, 'w' do |io|
|
File.open readme_ext, 'w' do |io|
|
||||||
io.puts "# -*- coding: utf-8 -*-"
|
io.puts "# -*- coding: utf-8 -*-"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_check_modeline_with_other
|
def test_check_modeline_with_other
|
||||||
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
||||||
|
|
||||||
open readme_ext, 'w' do |io|
|
File.open readme_ext, 'w' do |io|
|
||||||
io.puts "# README.EXT - -*- mode: RDoc; indent-tabs-mode: nil -*-"
|
io.puts "# README.EXT - -*- mode: RDoc; indent-tabs-mode: nil -*-"
|
||||||
io.puts
|
io.puts
|
||||||
io.puts "This document explains how to make extension libraries for Ruby."
|
io.puts "This document explains how to make extension libraries for Ruby."
|
||||||
|
@ -202,7 +202,7 @@ class TestRDocParser < RDoc::TestCase
|
||||||
def test_check_modeline_no_modeline
|
def test_check_modeline_no_modeline
|
||||||
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
|
||||||
|
|
||||||
open readme_ext, 'w' do |io|
|
File.open readme_ext, 'w' do |io|
|
||||||
io.puts "This document explains how to make extension libraries for Ruby."
|
io.puts "This document explains how to make extension libraries for Ruby."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
TODO: test call-seq parsing
|
TODO: test call-seq parsing
|
||||||
|
@ -327,7 +327,7 @@ VALUE cFoo = boot_defclass("Foo", 0);
|
||||||
|
|
||||||
klass = util_get_class content, 'cFoo'
|
klass = util_get_class content, 'cFoo'
|
||||||
assert_equal "this is the Foo boot class", klass.comment.text
|
assert_equal "this is the Foo boot class", klass.comment.text
|
||||||
assert_equal nil, klass.superclass
|
assert_nil klass.superclass
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_do_aliases_missing_class
|
def test_do_aliases_missing_class
|
||||||
|
@ -1377,7 +1377,7 @@ commercial() -> Date <br />
|
||||||
|
|
||||||
parser.find_modifiers comment, method_obj
|
parser.find_modifiers comment, method_obj
|
||||||
|
|
||||||
assert_equal nil, method_obj.document_self
|
assert_nil method_obj.document_self
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_modifiers_yields
|
def test_find_modifiers_yields
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParserChangeLog < RDoc::TestCase
|
class TestRDocParserChangeLog < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParserMarkdown < RDoc::TestCase
|
class TestRDocParserMarkdown < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParserRd < RDoc::TestCase
|
class TestRDocParserRd < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParserRuby < RDoc::TestCase
|
class TestRDocParserRuby < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -231,8 +231,8 @@ class C; end
|
||||||
@parser.look_for_directives_in @top_level, comment
|
@parser.look_for_directives_in @top_level, comment
|
||||||
|
|
||||||
section = @top_level.current_section
|
section = @top_level.current_section
|
||||||
assert_equal nil, section.title
|
assert_nil section.title
|
||||||
assert_equal nil, section.comment
|
assert_nil section.comment
|
||||||
|
|
||||||
assert_equal "# how to make a section:\n# # :section: new section\n",
|
assert_equal "# how to make a section:\n# # :section: new section\n",
|
||||||
comment.text
|
comment.text
|
||||||
|
@ -306,6 +306,67 @@ ruby
|
||||||
assert_equal @top_level, sum.file
|
assert_equal @top_level, sum.file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_on_ignored_nl_with_nil_text
|
||||||
|
util_parser <<ruby
|
||||||
|
class Foo
|
||||||
|
def meth
|
||||||
|
variable # comment
|
||||||
|
.chain
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby
|
||||||
|
|
||||||
|
expected = <<EXPECTED
|
||||||
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meth</span>
|
||||||
|
<span class="ruby-identifier">variable</span> <span class="ruby-comment"># comment</span>
|
||||||
|
.<span class="ruby-identifier">chain</span>
|
||||||
|
<span class="ruby-keyword">end</span>
|
||||||
|
EXPECTED
|
||||||
|
expected = expected.rstrip
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
foo = @store.find_class_named 'Foo'
|
||||||
|
meth = foo.method_list.first
|
||||||
|
|
||||||
|
assert_equal 'meth', meth.name
|
||||||
|
assert_equal @top_level, meth.file
|
||||||
|
|
||||||
|
markup_code = meth.markup_code.sub(/^.*\n/, '')
|
||||||
|
assert_equal expected, markup_code
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parse_redefined_op_with_constant
|
||||||
|
klass = RDoc::NormalClass.new 'Foo'
|
||||||
|
klass.parent = @top_level
|
||||||
|
|
||||||
|
comment = RDoc::Comment.new '', @top_level
|
||||||
|
|
||||||
|
util_parser <<ruby
|
||||||
|
def meth
|
||||||
|
Integer::**()
|
||||||
|
return Integer::**()
|
||||||
|
break Integer::**()
|
||||||
|
case Integer::**()
|
||||||
|
when Integer::**()
|
||||||
|
end
|
||||||
|
while Integer::**()
|
||||||
|
end
|
||||||
|
yield Integer::**()
|
||||||
|
defined? Integer::**()
|
||||||
|
if Integer::**()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby
|
||||||
|
|
||||||
|
tk = @parser.get_tk
|
||||||
|
|
||||||
|
@parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
|
||||||
|
|
||||||
|
meth = klass.method_list.first
|
||||||
|
assert_equal 'meth', meth.name
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_alias
|
def test_parse_alias
|
||||||
klass = RDoc::NormalClass.new 'Foo'
|
klass = RDoc::NormalClass.new 'Foo'
|
||||||
klass.parent = @top_level
|
klass.parent = @top_level
|
||||||
|
@ -813,6 +874,31 @@ end
|
||||||
assert_match(/Expected class name or '<<'\. Got/, err)
|
assert_match(/Expected class name or '<<'\. Got/, err)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_syntax_error_code
|
||||||
|
@options.verbosity = 2
|
||||||
|
stds = capture_io do
|
||||||
|
begin
|
||||||
|
util_parser <<INVALID_CODE
|
||||||
|
# invalid class name
|
||||||
|
class Invalid::@@Code
|
||||||
|
end
|
||||||
|
INVALID_CODE
|
||||||
|
@parser.scan
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
err = stds[1]
|
||||||
|
|
||||||
|
expected = <<EXPECTED
|
||||||
|
RDoc::Parser::Ruby failure around line 2 of
|
||||||
|
#{@filename}
|
||||||
|
|
||||||
|
class Invalid::@@Code
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
assert_match(expected, err)
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_multi_ghost_methods
|
def test_parse_multi_ghost_methods
|
||||||
util_parser <<-'CLASS'
|
util_parser <<-'CLASS'
|
||||||
class Foo
|
class Foo
|
||||||
|
@ -1139,7 +1225,7 @@ EOF
|
||||||
assert_equal @top_level, foo.file
|
assert_equal @top_level, foo.file
|
||||||
assert_equal 1, foo.line
|
assert_equal 1, foo.line
|
||||||
|
|
||||||
assert_equal nil, foo.viewer
|
assert_nil foo.viewer
|
||||||
assert_equal true, foo.document_children
|
assert_equal true, foo.document_children
|
||||||
assert_equal true, foo.document_self
|
assert_equal true, foo.document_self
|
||||||
assert_equal false, foo.done_documenting
|
assert_equal false, foo.done_documenting
|
||||||
|
@ -1202,21 +1288,21 @@ EOF
|
||||||
assert_equal @top_level, foo.file
|
assert_equal @top_level, foo.file
|
||||||
assert_equal 1, foo.line
|
assert_equal 1, foo.line
|
||||||
|
|
||||||
assert_equal [], foo.aliases
|
assert_equal [], foo.aliases
|
||||||
assert_equal nil, foo.block_params
|
assert_nil foo.block_params
|
||||||
assert_equal nil, foo.call_seq
|
assert_nil foo.call_seq
|
||||||
assert_equal nil, foo.is_alias_for
|
assert_nil foo.is_alias_for
|
||||||
assert_equal nil, foo.viewer
|
assert_nil foo.viewer
|
||||||
assert_equal true, foo.document_children
|
assert_equal true, foo.document_children
|
||||||
assert_equal true, foo.document_self
|
assert_equal true, foo.document_self
|
||||||
assert_equal '', foo.params
|
assert_equal '', foo.params
|
||||||
assert_equal false, foo.done_documenting
|
assert_equal false, foo.done_documenting
|
||||||
assert_equal false, foo.dont_rename_initialize
|
assert_equal false, foo.dont_rename_initialize
|
||||||
assert_equal false, foo.force_documentation
|
assert_equal false, foo.force_documentation
|
||||||
assert_equal klass, foo.parent
|
assert_equal klass, foo.parent
|
||||||
assert_equal false, foo.singleton
|
assert_equal false, foo.singleton
|
||||||
assert_equal :public, foo.visibility
|
assert_equal :public, foo.visibility
|
||||||
assert_equal "\n", foo.text
|
assert_equal "\n", foo.text
|
||||||
assert_equal klass.current_section, foo.section
|
assert_equal klass.current_section, foo.section
|
||||||
|
|
||||||
stream = [
|
stream = [
|
||||||
|
@ -1302,6 +1388,9 @@ EOF
|
||||||
|
|
||||||
@parser.parse_constant klass, tk, @comment
|
@parser.parse_constant klass, tk, @comment
|
||||||
|
|
||||||
|
assert_equal [], klass.modules.map(&:full_name)
|
||||||
|
assert_equal ['Foo::B', 'Foo::A'], klass.classes.map(&:full_name)
|
||||||
|
assert_equal ['Foo::A'], klass.constants.map(&:full_name)
|
||||||
assert_equal 'Foo::A', klass.find_module_named('A').full_name
|
assert_equal 'Foo::A', klass.find_module_named('A').full_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1516,19 +1605,19 @@ end
|
||||||
assert_equal 1, foo.line
|
assert_equal 1, foo.line
|
||||||
|
|
||||||
assert_equal [], foo.aliases
|
assert_equal [], foo.aliases
|
||||||
assert_equal nil, foo.block_params
|
assert_nil foo.block_params
|
||||||
assert_equal nil, foo.call_seq
|
assert_nil foo.call_seq
|
||||||
assert_equal true, foo.document_children
|
assert_equal true, foo.document_children
|
||||||
assert_equal true, foo.document_self
|
assert_equal true, foo.document_self
|
||||||
assert_equal false, foo.done_documenting
|
assert_equal false, foo.done_documenting
|
||||||
assert_equal false, foo.dont_rename_initialize
|
assert_equal false, foo.dont_rename_initialize
|
||||||
assert_equal false, foo.force_documentation
|
assert_equal false, foo.force_documentation
|
||||||
assert_equal nil, foo.is_alias_for
|
assert_nil foo.is_alias_for
|
||||||
assert_equal '', foo.params
|
assert_equal '', foo.params
|
||||||
assert_equal klass, foo.parent
|
assert_equal klass, foo.parent
|
||||||
assert_equal false, foo.singleton
|
assert_equal false, foo.singleton
|
||||||
assert_equal 'add_my_method :foo', foo.text
|
assert_equal 'add_my_method :foo', foo.text
|
||||||
assert_equal nil, foo.viewer
|
assert_nil foo.viewer
|
||||||
assert_equal :public, foo.visibility
|
assert_equal :public, foo.visibility
|
||||||
assert_equal klass.current_section, foo.section
|
assert_equal klass.current_section, foo.section
|
||||||
|
|
||||||
|
@ -1726,10 +1815,10 @@ end
|
||||||
assert_equal 1, foo.line
|
assert_equal 1, foo.line
|
||||||
|
|
||||||
assert_equal [], foo.aliases
|
assert_equal [], foo.aliases
|
||||||
assert_equal nil, foo.block_params
|
assert_nil foo.block_params
|
||||||
assert_equal nil, foo.call_seq
|
assert_nil foo.call_seq
|
||||||
assert_equal nil, foo.is_alias_for
|
assert_nil foo.is_alias_for
|
||||||
assert_equal nil, foo.viewer
|
assert_nil foo.viewer
|
||||||
assert_equal true, foo.document_children
|
assert_equal true, foo.document_children
|
||||||
assert_equal true, foo.document_self
|
assert_equal true, foo.document_self
|
||||||
assert_equal '()', foo.params
|
assert_equal '()', foo.params
|
||||||
|
@ -2981,12 +3070,12 @@ RUBY
|
||||||
|
|
||||||
@parser.skip_tkspace
|
@parser.skip_tkspace
|
||||||
|
|
||||||
assert_equal nil, @parser.parse_symbol_in_arg
|
assert_nil @parser.parse_symbol_in_arg
|
||||||
@parser.get_tk # skip ','
|
@parser.get_tk # skip ','
|
||||||
|
|
||||||
@parser.skip_tkspace
|
@parser.skip_tkspace
|
||||||
|
|
||||||
assert_equal nil, @parser.parse_symbol_in_arg
|
assert_nil @parser.parse_symbol_in_arg
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_statements_alias_method
|
def test_parse_statements_alias_method
|
||||||
|
@ -3090,7 +3179,7 @@ end
|
||||||
assert_equal 'category', directive
|
assert_equal 'category', directive
|
||||||
assert_equal 'test', value
|
assert_equal 'test', value
|
||||||
|
|
||||||
assert_equal nil, parser.get_tk
|
assert_nil parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_directive_allow
|
def test_read_directive_allow
|
||||||
|
@ -3100,7 +3189,7 @@ end
|
||||||
|
|
||||||
assert_nil directive
|
assert_nil directive
|
||||||
|
|
||||||
assert_equal nil, parser.get_tk
|
assert_nil parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_directive_empty
|
def test_read_directive_empty
|
||||||
|
@ -3110,7 +3199,7 @@ end
|
||||||
|
|
||||||
assert_nil directive
|
assert_nil directive
|
||||||
|
|
||||||
assert_equal nil, parser.get_tk
|
assert_nil parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_directive_no_comment
|
def test_read_directive_no_comment
|
||||||
|
@ -3120,7 +3209,7 @@ end
|
||||||
|
|
||||||
assert_nil directive
|
assert_nil directive
|
||||||
|
|
||||||
assert_equal nil, parser.get_tk
|
assert_nil parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_directive_one_liner
|
def test_read_directive_one_liner
|
||||||
|
@ -3197,14 +3286,14 @@ end
|
||||||
util_parser '"#{"#{"a")}" if b}"'
|
util_parser '"#{"#{"a")}" if b}"'
|
||||||
|
|
||||||
assert_equal '"#{"#{"a")}" if b}"', @parser.get_tk[:text]
|
assert_equal '"#{"#{"a")}" if b}"', @parser.get_tk[:text]
|
||||||
assert_equal nil, @parser.get_tk
|
assert_nil @parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanity_interpolation_curly
|
def test_sanity_interpolation_curly
|
||||||
util_parser '%{ #{} }'
|
util_parser '%{ #{} }'
|
||||||
|
|
||||||
assert_equal '%{ #{} }', @parser.get_tk[:text]
|
assert_equal '%{ #{} }', @parser.get_tk[:text]
|
||||||
assert_equal nil, @parser.get_tk
|
assert_nil @parser.get_tk
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanity_interpolation_format
|
def test_sanity_interpolation_format
|
||||||
|
@ -3842,4 +3931,150 @@ end
|
||||||
second_file_content, @options, @stats
|
second_file_content, @options, @stats
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_parse_const_third_party
|
||||||
|
util_parser <<-CLASS
|
||||||
|
class A
|
||||||
|
true if B
|
||||||
|
true if B::C
|
||||||
|
true if B::C::D
|
||||||
|
|
||||||
|
module B
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLASS
|
||||||
|
|
||||||
|
tk = @parser.get_tk
|
||||||
|
|
||||||
|
@parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
|
||||||
|
|
||||||
|
a = @top_level.classes.first
|
||||||
|
assert_equal 'A', a.full_name
|
||||||
|
|
||||||
|
visible = @store.all_modules.reject { |mod| mod.suppressed? }
|
||||||
|
visible = visible.map { |mod| mod.full_name }
|
||||||
|
|
||||||
|
assert_equal ['A::B'], visible
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parse_const_alias_defined_elsewhere
|
||||||
|
util_parser <<-CLASS
|
||||||
|
module A
|
||||||
|
Aliased = Defined
|
||||||
|
end
|
||||||
|
|
||||||
|
module A
|
||||||
|
class Defined
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLASS
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
a = @top_level.modules.first
|
||||||
|
assert_equal 'A', a.full_name
|
||||||
|
aliased = a.constants.first
|
||||||
|
assert_equal 'A::Aliased', aliased.full_name
|
||||||
|
assert_equal [], a.modules.map(&:full_name)
|
||||||
|
assert_equal ['A::Defined', 'A::Aliased'], a.classes.map(&:full_name)
|
||||||
|
assert_equal ['A::Aliased'], a.constants.map(&:full_name)
|
||||||
|
|
||||||
|
visible = @store.all_modules.reject { |mod| mod.suppressed? }
|
||||||
|
visible = visible.map { |mod| mod.full_name }
|
||||||
|
|
||||||
|
assert_equal ['A'], visible
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parse_const_alias_defined_far_away
|
||||||
|
util_parser <<-CLASS
|
||||||
|
module A
|
||||||
|
Aliased = ::B::C::Defined
|
||||||
|
end
|
||||||
|
|
||||||
|
module B
|
||||||
|
module C
|
||||||
|
class Defined
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLASS
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
a = @top_level.modules.first
|
||||||
|
assert_equal 'A', a.full_name
|
||||||
|
assert_empty a.classes
|
||||||
|
assert_empty a.modules
|
||||||
|
assert_equal ['A::Aliased'], a.constants.map(&:full_name)
|
||||||
|
|
||||||
|
defined = @store.find_class_named 'B::C::Defined'
|
||||||
|
assert_equal 'B::C::Defined', defined.full_name
|
||||||
|
|
||||||
|
aliased = @store.find_class_named 'B::C::Aliased'
|
||||||
|
assert_equal 'B::C::Aliased', aliased.full_name
|
||||||
|
|
||||||
|
visible = @store.all_modules.reject { |mod| mod.suppressed? }
|
||||||
|
visible = visible.map { |mod| mod.full_name }
|
||||||
|
|
||||||
|
assert_equal ['A', 'B', 'B::C'], visible
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parse_const_alias_defined_elsewhere
|
||||||
|
util_parser <<-CLASS
|
||||||
|
module A
|
||||||
|
Aliased = Defined
|
||||||
|
end
|
||||||
|
|
||||||
|
module A
|
||||||
|
class Defined
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLASS
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
a = @top_level.modules.first
|
||||||
|
assert_equal 'A', a.full_name
|
||||||
|
aliased = a.constants.first
|
||||||
|
assert_equal 'A::Aliased', aliased.full_name
|
||||||
|
|
||||||
|
visible = @store.all_modules.reject { |mod| mod.suppressed? }
|
||||||
|
visible = visible.map { |mod| mod.full_name }
|
||||||
|
|
||||||
|
assert_equal ['A'], visible
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parse_const_alias_defined_far_away
|
||||||
|
util_parser <<-CLASS
|
||||||
|
module A
|
||||||
|
Aliased = ::B::C::Defined
|
||||||
|
end
|
||||||
|
|
||||||
|
module B
|
||||||
|
module C
|
||||||
|
class Defined
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLASS
|
||||||
|
|
||||||
|
@parser.scan
|
||||||
|
|
||||||
|
a = @top_level.modules.first
|
||||||
|
assert_equal 'A', a.full_name
|
||||||
|
assert_empty a.classes
|
||||||
|
assert_empty a.modules
|
||||||
|
assert_equal ['A::Aliased'], a.constants.map(&:full_name)
|
||||||
|
|
||||||
|
defined = @store.find_class_named 'B::C::Defined'
|
||||||
|
assert_equal 'B::C::Defined', defined.full_name
|
||||||
|
|
||||||
|
aliased = @store.find_class_named 'B::C::Aliased'
|
||||||
|
assert_equal 'B::C::Aliased', aliased.full_name
|
||||||
|
|
||||||
|
visible = @store.all_modules.reject { |mod| mod.suppressed? }
|
||||||
|
visible = visible.map { |mod| mod.full_name }
|
||||||
|
|
||||||
|
assert_equal ['A', 'B', 'B::C'], visible
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocParserSimple < RDoc::TestCase
|
class TestRDocParserSimple < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRd < RDoc::TestCase
|
class TestRDocRd < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRdBlockParser < RDoc::TestCase
|
class TestRDocRdBlockParser < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRdInline < RDoc::TestCase
|
class TestRDocRdInline < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRdInlineParser < RDoc::TestCase
|
class TestRDocRdInlineParser < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRDoc < RDoc::TestCase
|
class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_load_options_invalid
|
def test_load_options_invalid
|
||||||
temp_dir do
|
temp_dir do
|
||||||
open '.rdoc_options', 'w' do |io|
|
File.open '.rdoc_options', 'w' do |io|
|
||||||
io.write "a: !ruby.yaml.org,2002:str |\nfoo"
|
io.write "a: !ruby.yaml.org,2002:str |\nfoo"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -181,13 +181,67 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
assert_match %r"#{dev}$", err
|
assert_match %r"#{dev}$", err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_normalized_file_list_with_dot_doc
|
||||||
|
expected_files = []
|
||||||
|
files = temp_dir do |dir|
|
||||||
|
a = File.expand_path('a.rb')
|
||||||
|
b = File.expand_path('b.rb')
|
||||||
|
c = File.expand_path('c.rb')
|
||||||
|
FileUtils.touch a
|
||||||
|
FileUtils.touch b
|
||||||
|
FileUtils.touch c
|
||||||
|
|
||||||
|
dot_doc = File.expand_path('.document')
|
||||||
|
FileUtils.touch dot_doc
|
||||||
|
open(dot_doc, 'w') do |f|
|
||||||
|
f.puts 'a.rb'
|
||||||
|
f.puts 'b.rb'
|
||||||
|
end
|
||||||
|
expected_files << a
|
||||||
|
expected_files << b
|
||||||
|
|
||||||
|
@rdoc.normalized_file_list [File.realpath(dir)]
|
||||||
|
end
|
||||||
|
|
||||||
|
files = files.map { |file| File.expand_path file }
|
||||||
|
|
||||||
|
assert_equal expected_files, files
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_normalized_file_list_with_dot_doc_overridden_by_exclude_option
|
||||||
|
expected_files = []
|
||||||
|
files = temp_dir do |dir|
|
||||||
|
a = File.expand_path('a.rb')
|
||||||
|
b = File.expand_path('b.rb')
|
||||||
|
c = File.expand_path('c.rb')
|
||||||
|
FileUtils.touch a
|
||||||
|
FileUtils.touch b
|
||||||
|
FileUtils.touch c
|
||||||
|
|
||||||
|
dot_doc = File.expand_path('.document')
|
||||||
|
FileUtils.touch dot_doc
|
||||||
|
open(dot_doc, 'w') do |f|
|
||||||
|
f.puts 'a.rb'
|
||||||
|
f.puts 'b.rb'
|
||||||
|
end
|
||||||
|
expected_files << a
|
||||||
|
|
||||||
|
@rdoc.options.exclude = Regexp.new(['b.rb'].join('|'))
|
||||||
|
@rdoc.normalized_file_list [File.realpath(dir)]
|
||||||
|
end
|
||||||
|
|
||||||
|
files = files.map { |file| File.expand_path file }
|
||||||
|
|
||||||
|
assert_equal expected_files, files
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_file
|
def test_parse_file
|
||||||
@rdoc.store = RDoc::Store.new
|
@rdoc.store = RDoc::Store.new
|
||||||
|
|
||||||
temp_dir do |dir|
|
temp_dir do |dir|
|
||||||
@rdoc.options.root = Pathname(Dir.pwd)
|
@rdoc.options.root = Pathname(Dir.pwd)
|
||||||
|
|
||||||
open 'test.txt', 'w' do |io|
|
File.open 'test.txt', 'w' do |io|
|
||||||
io.puts 'hi'
|
io.puts 'hi'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -223,7 +277,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
temp_dir do |dir|
|
temp_dir do |dir|
|
||||||
@rdoc.options.parse %W[--root #{test_path}]
|
@rdoc.options.parse %W[--root #{test_path}]
|
||||||
|
|
||||||
open 'include.txt', 'w' do |io|
|
File.open 'include.txt', 'w' do |io|
|
||||||
io.puts ':include: test.txt'
|
io.puts ':include: test.txt'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -244,7 +298,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
@rdoc.options.page_dir = Pathname('pages')
|
@rdoc.options.page_dir = Pathname('pages')
|
||||||
@rdoc.options.root = Pathname(Dir.pwd)
|
@rdoc.options.root = Pathname(Dir.pwd)
|
||||||
|
|
||||||
open 'pages/test.txt', 'w' do |io|
|
File.open 'pages/test.txt', 'w' do |io|
|
||||||
io.puts 'hi'
|
io.puts 'hi'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -263,7 +317,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
temp_dir do |dir|
|
temp_dir do |dir|
|
||||||
@rdoc.options.root = Pathname(dir)
|
@rdoc.options.root = Pathname(dir)
|
||||||
|
|
||||||
open 'test.txt', 'w' do |io|
|
File.open 'test.txt', 'w' do |io|
|
||||||
io.puts 'hi'
|
io.puts 'hi'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -296,7 +350,6 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_parse_file_forbidden
|
def test_parse_file_forbidden
|
||||||
skip 'chmod not supported' if Gem.win_platform?
|
skip 'chmod not supported' if Gem.win_platform?
|
||||||
skip 'skipped in root privilege' if Process.uid == 0
|
|
||||||
|
|
||||||
@rdoc.store = RDoc::Store.new
|
@rdoc.store = RDoc::Store.new
|
||||||
|
|
||||||
|
@ -340,7 +393,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_remove_unparseable_tags_emacs
|
def test_remove_unparseable_tags_emacs
|
||||||
temp_dir do
|
temp_dir do
|
||||||
open 'TAGS', 'wb' do |io| # emacs
|
File.open 'TAGS', 'wb' do |io| # emacs
|
||||||
io.write "\f\nlib/foo.rb,43\n"
|
io.write "\f\nlib/foo.rb,43\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -354,7 +407,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_remove_unparseable_tags_vim
|
def test_remove_unparseable_tags_vim
|
||||||
temp_dir do
|
temp_dir do
|
||||||
open 'TAGS', 'w' do |io| # emacs
|
File.open 'TAGS', 'w' do |io| # emacs
|
||||||
io.write "!_TAG_"
|
io.write "!_TAG_"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -393,7 +446,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_setup_output_dir_exists
|
def test_setup_output_dir_exists
|
||||||
Dir.mktmpdir {|path|
|
Dir.mktmpdir {|path|
|
||||||
open @rdoc.output_flag_file(path), 'w' do |io|
|
File.open @rdoc.output_flag_file(path), 'w' do |io|
|
||||||
io.puts Time.at 0
|
io.puts Time.at 0
|
||||||
io.puts "./lib/rdoc.rb\t#{Time.at 86400}"
|
io.puts "./lib/rdoc.rb\t#{Time.at 86400}"
|
||||||
end
|
end
|
||||||
|
@ -407,7 +460,7 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
|
|
||||||
def test_setup_output_dir_exists_empty_created_rid
|
def test_setup_output_dir_exists_empty_created_rid
|
||||||
Dir.mktmpdir {|path|
|
Dir.mktmpdir {|path|
|
||||||
open @rdoc.output_flag_file(path), 'w' do end
|
File.open @rdoc.output_flag_file(path), 'w' do end
|
||||||
|
|
||||||
e = assert_raises RDoc::Error do
|
e = assert_raises RDoc::Error do
|
||||||
@rdoc.setup_output_dir path, false
|
@rdoc.setup_output_dir path, false
|
||||||
|
@ -468,6 +521,25 @@ class TestRDocRDoc < RDoc::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_update_output_dir_with_reproducible_time
|
||||||
|
Dir.mktmpdir do |d|
|
||||||
|
backup_epoch = ENV['SOURCE_DATE_EPOCH']
|
||||||
|
ruby_birthday = Time.parse 'Wed, 24 Feb 1993 21:00:00 +0900'
|
||||||
|
ENV['SOURCE_DATE_EPOCH'] = ruby_birthday.to_i.to_s
|
||||||
|
|
||||||
|
@rdoc.update_output_dir d, Time.now, {}
|
||||||
|
|
||||||
|
assert File.exist? "#{d}/created.rid"
|
||||||
|
|
||||||
|
f = File.open("#{d}/created.rid", 'r')
|
||||||
|
head_timestamp = Time.parse f.gets.chomp
|
||||||
|
f.close
|
||||||
|
assert_equal ruby_birthday, head_timestamp
|
||||||
|
|
||||||
|
ENV['SOURCE_DATE_EPOCH'] = backup_epoch
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_normalized_file_list_removes_created_rid_dir
|
def test_normalized_file_list_removes_created_rid_dir
|
||||||
temp_dir do |d|
|
temp_dir do |d|
|
||||||
FileUtils.mkdir "doc"
|
FileUtils.mkdir "doc"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRIDriver < RDoc::TestCase
|
class TestRDocRIDriver < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -243,6 +243,32 @@ class TestRDocRIDriver < RDoc::TestCase
|
||||||
assert_equal expected, out
|
assert_equal expected, out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_add_method_that_is_alias_for_original
|
||||||
|
util_store
|
||||||
|
|
||||||
|
out = doc
|
||||||
|
|
||||||
|
@driver.add_method out, 'Qux#aliased'
|
||||||
|
|
||||||
|
expected =
|
||||||
|
doc(
|
||||||
|
head(1, 'Qux#aliased'),
|
||||||
|
blank_line,
|
||||||
|
para('(from ~/.rdoc)'),
|
||||||
|
rule(1),
|
||||||
|
blank_line,
|
||||||
|
para('alias comment'),
|
||||||
|
blank_line,
|
||||||
|
blank_line,
|
||||||
|
para('(this method is alias for Qux#original)'),
|
||||||
|
blank_line,
|
||||||
|
para('original comment'),
|
||||||
|
blank_line,
|
||||||
|
blank_line)
|
||||||
|
|
||||||
|
assert_equal expected, out
|
||||||
|
end
|
||||||
|
|
||||||
def test_add_method_attribute
|
def test_add_method_attribute
|
||||||
util_store
|
util_store
|
||||||
|
|
||||||
|
@ -348,6 +374,22 @@ class TestRDocRIDriver < RDoc::TestCase
|
||||||
assert_equal expected, out
|
assert_equal expected, out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_output_width
|
||||||
|
@options[:width] = 10
|
||||||
|
driver = RDoc::RI::Driver.new @options
|
||||||
|
|
||||||
|
doc = @RM::Document.new
|
||||||
|
doc << @RM::IndentedParagraph.new(0, 'new, parse, foo, bar, baz')
|
||||||
|
|
||||||
|
out, = capture_io do
|
||||||
|
driver.display doc
|
||||||
|
end
|
||||||
|
|
||||||
|
expected = "new, parse, foo,\nbar, baz\n"
|
||||||
|
|
||||||
|
assert_equal expected, out
|
||||||
|
end
|
||||||
|
|
||||||
def test_add_method_list_interative
|
def test_add_method_list_interative
|
||||||
@options[:interactive] = true
|
@options[:interactive] = true
|
||||||
driver = RDoc::RI::Driver.new @options
|
driver = RDoc::RI::Driver.new @options
|
||||||
|
@ -390,6 +432,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
||||||
'Foo::Bar' => [@store1],
|
'Foo::Bar' => [@store1],
|
||||||
'Foo::Baz' => [@store1, @store2],
|
'Foo::Baz' => [@store1, @store2],
|
||||||
'Inc' => [@store1],
|
'Inc' => [@store1],
|
||||||
|
'Qux' => [@store1],
|
||||||
}
|
}
|
||||||
|
|
||||||
classes = @driver.classes
|
classes = @driver.classes
|
||||||
|
@ -923,6 +966,7 @@ Foo::Bar#bother
|
||||||
[@store1, 'Foo::Bar', 'Foo::Bar', :both, 'blah'],
|
[@store1, 'Foo::Bar', 'Foo::Bar', :both, 'blah'],
|
||||||
[@store1, 'Foo::Baz', 'Foo::Baz', :both, 'blah'],
|
[@store1, 'Foo::Baz', 'Foo::Baz', :both, 'blah'],
|
||||||
[@store1, 'Inc', 'Inc', :both, 'blah'],
|
[@store1, 'Inc', 'Inc', :both, 'blah'],
|
||||||
|
[@store1, 'Qux', 'Qux', :both, 'blah'],
|
||||||
]
|
]
|
||||||
|
|
||||||
assert_equal expected, items
|
assert_equal expected, items
|
||||||
|
@ -1056,7 +1100,7 @@ Foo::Bar#bother
|
||||||
@driver.list_known_classes
|
@driver.list_known_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out
|
assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\nQux\n", out
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_list_known_classes_name
|
def test_list_known_classes_name
|
||||||
|
@ -1127,7 +1171,7 @@ Foo::Bar#bother
|
||||||
method = @driver.load_method(@store2, :instance_methods, 'Bar', '#',
|
method = @driver.load_method(@store2, :instance_methods, 'Bar', '#',
|
||||||
'inherit')
|
'inherit')
|
||||||
|
|
||||||
assert_equal nil, method
|
assert_nil method
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_load_methods_matching
|
def test_load_methods_matching
|
||||||
|
@ -1232,7 +1276,7 @@ Foo::Bar#bother
|
||||||
|
|
||||||
assert_equal 'ruby', klass, 'ruby project'
|
assert_equal 'ruby', klass, 'ruby project'
|
||||||
assert_equal ':', type, 'ruby type'
|
assert_equal ':', type, 'ruby type'
|
||||||
assert_equal nil, meth, 'ruby page'
|
assert_nil meth, 'ruby page'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parse_name_page_extenson
|
def test_parse_name_page_extenson
|
||||||
|
@ -1247,26 +1291,26 @@ Foo::Bar#bother
|
||||||
klass, type, meth = @driver.parse_name 'Foo'
|
klass, type, meth = @driver.parse_name 'Foo'
|
||||||
|
|
||||||
assert_equal 'Foo', klass, 'Foo class'
|
assert_equal 'Foo', klass, 'Foo class'
|
||||||
assert_equal nil, type, 'Foo type'
|
assert_nil type, 'Foo type'
|
||||||
assert_equal nil, meth, 'Foo method'
|
assert_nil meth, 'Foo method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo#'
|
klass, type, meth = @driver.parse_name 'Foo#'
|
||||||
|
|
||||||
assert_equal 'Foo', klass, 'Foo# class'
|
assert_equal 'Foo', klass, 'Foo# class'
|
||||||
assert_equal '#', type, 'Foo# type'
|
assert_equal '#', type, 'Foo# type'
|
||||||
assert_equal nil, meth, 'Foo# method'
|
assert_nil meth, 'Foo# method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo::'
|
klass, type, meth = @driver.parse_name 'Foo::'
|
||||||
|
|
||||||
assert_equal 'Foo', klass, 'Foo:: class'
|
assert_equal 'Foo', klass, 'Foo:: class'
|
||||||
assert_equal '::', type, 'Foo:: type'
|
assert_equal '::', type, 'Foo:: type'
|
||||||
assert_equal nil, meth, 'Foo:: method'
|
assert_nil meth, 'Foo:: method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo.'
|
klass, type, meth = @driver.parse_name 'Foo.'
|
||||||
|
|
||||||
assert_equal 'Foo', klass, 'Foo. class'
|
assert_equal 'Foo', klass, 'Foo. class'
|
||||||
assert_equal '.', type, 'Foo. type'
|
assert_equal '.', type, 'Foo. type'
|
||||||
assert_equal nil, meth, 'Foo. method'
|
assert_nil meth, 'Foo. method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo#Bar'
|
klass, type, meth = @driver.parse_name 'Foo#Bar'
|
||||||
|
|
||||||
|
@ -1291,14 +1335,14 @@ Foo::Bar#bother
|
||||||
klass, type, meth = @driver.parse_name 'Foo::Bar'
|
klass, type, meth = @driver.parse_name 'Foo::Bar'
|
||||||
|
|
||||||
assert_equal 'Foo::Bar', klass, 'Foo::Bar class'
|
assert_equal 'Foo::Bar', klass, 'Foo::Bar class'
|
||||||
assert_equal nil, type, 'Foo::Bar type'
|
assert_nil type, 'Foo::Bar type'
|
||||||
assert_equal nil, meth, 'Foo::Bar method'
|
assert_nil meth, 'Foo::Bar method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo::Bar#'
|
klass, type, meth = @driver.parse_name 'Foo::Bar#'
|
||||||
|
|
||||||
assert_equal 'Foo::Bar', klass, 'Foo::Bar# class'
|
assert_equal 'Foo::Bar', klass, 'Foo::Bar# class'
|
||||||
assert_equal '#', type, 'Foo::Bar# type'
|
assert_equal '#', type, 'Foo::Bar# type'
|
||||||
assert_equal nil, meth, 'Foo::Bar# method'
|
assert_nil meth, 'Foo::Bar# method'
|
||||||
|
|
||||||
klass, type, meth = @driver.parse_name 'Foo::Bar#baz'
|
klass, type, meth = @driver.parse_name 'Foo::Bar#baz'
|
||||||
|
|
||||||
|
@ -1481,6 +1525,15 @@ Foo::Bar#bother
|
||||||
@overridden.comment = 'must not be displayed in Bar#override'
|
@overridden.comment = 'must not be displayed in Bar#override'
|
||||||
@overridden.record_location @top_level
|
@overridden.record_location @top_level
|
||||||
|
|
||||||
|
@cQux = @top_level.add_class RDoc::NormalClass, 'Qux'
|
||||||
|
|
||||||
|
@original = @cQux.add_method RDoc::AnyMethod.new(nil, 'original')
|
||||||
|
@original.comment = 'original comment'
|
||||||
|
@original.record_location @top_level
|
||||||
|
|
||||||
|
@aliased = @original.add_alias RDoc::Alias.new(nil, 'original', 'aliased', 'alias comment'), @cQux
|
||||||
|
@aliased.record_location @top_level
|
||||||
|
|
||||||
@store1.save
|
@store1.save
|
||||||
|
|
||||||
@driver.stores = [@store1]
|
@driver.stores = [@store1]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocRIPaths < RDoc::TestCase
|
class TestRDocRIPaths < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class TestRDocRIPaths < RDoc::TestCase
|
||||||
specs.each do |spec|
|
specs.each do |spec|
|
||||||
spec.loaded_from = spec.spec_file
|
spec.loaded_from = spec.spec_file
|
||||||
|
|
||||||
open spec.spec_file, 'w' do |file|
|
File.open spec.spec_file, 'w' do |file|
|
||||||
file.write spec.to_ruby_for_cache
|
file.write spec.to_ruby_for_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,6 @@ class TestRDocRubygemsHook < Gem::TestCase
|
||||||
|
|
||||||
def test_remove_unwritable
|
def test_remove_unwritable
|
||||||
skip 'chmod not supported' if Gem.win_platform?
|
skip 'chmod not supported' if Gem.win_platform?
|
||||||
skip 'skipped in root privilege' if Process.uid == 0
|
|
||||||
FileUtils.mkdir_p @a.base_dir
|
FileUtils.mkdir_p @a.base_dir
|
||||||
FileUtils.chmod 0, @a.base_dir
|
FileUtils.chmod 0, @a.base_dir
|
||||||
|
|
||||||
|
@ -229,7 +228,6 @@ class TestRDocRubygemsHook < Gem::TestCase
|
||||||
|
|
||||||
def test_setup_unwritable
|
def test_setup_unwritable
|
||||||
skip 'chmod not supported' if Gem.win_platform?
|
skip 'chmod not supported' if Gem.win_platform?
|
||||||
skip 'skipped in root privilege' if Process.uid == 0
|
|
||||||
FileUtils.mkdir_p @a.doc_dir
|
FileUtils.mkdir_p @a.doc_dir
|
||||||
FileUtils.chmod 0, @a.doc_dir
|
FileUtils.chmod 0, @a.doc_dir
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocServlet < RDoc::TestCase
|
class TestRDocServlet < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class TestRDocServlet < RDoc::TestCase
|
||||||
FileUtils.mkdir 'css'
|
FileUtils.mkdir 'css'
|
||||||
|
|
||||||
now = Time.now
|
now = Time.now
|
||||||
open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end
|
File.open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end
|
||||||
File.utime now, now, 'css/rdoc.css'
|
File.utime now, now, 'css/rdoc.css'
|
||||||
|
|
||||||
@s.asset_dirs[:darkfish] = '.'
|
@s.asset_dirs[:darkfish] = '.'
|
||||||
|
@ -143,7 +143,7 @@ class TestRDocServlet < RDoc::TestCase
|
||||||
|
|
||||||
@s.asset_dirs[:darkfish] = '.'
|
@s.asset_dirs[:darkfish] = '.'
|
||||||
|
|
||||||
@req.path = '/mount/path/css/rdoc.css'
|
@req.path = '/mount/path/css/rdoc.css'.dup
|
||||||
|
|
||||||
@s.do_GET @req, @res
|
@s.do_GET @req, @res
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocSingleClass < RDoc::TestCase
|
class TestRDocSingleClass < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocStats < RDoc::TestCase
|
class TestRDocStats < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
def test_all_classes_and_modules
|
def test_all_classes_and_modules
|
||||||
expected = %w[
|
expected = %w[
|
||||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7
|
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1
|
||||||
Child
|
Child
|
||||||
M1 M1::M2
|
M1 M1::M2
|
||||||
Parent
|
Parent
|
||||||
|
@ -213,7 +213,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
def test_classes
|
def test_classes
|
||||||
expected = %w[
|
expected = %w[
|
||||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7
|
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1
|
||||||
Child
|
Child
|
||||||
Parent
|
Parent
|
||||||
]
|
]
|
||||||
|
@ -222,7 +222,8 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_complete
|
def test_complete
|
||||||
@c2.add_module_alias @c2_c3, 'A1', @top_level
|
a1 = RDoc::Constant.new 'A1', '', ''
|
||||||
|
@c2.add_module_alias @c2_c3, @c2_c3.name, a1, @top_level
|
||||||
|
|
||||||
@store.complete :public
|
@store.complete :public
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
Dir.mkdir @tmpdir
|
Dir.mkdir @tmpdir
|
||||||
|
|
||||||
open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
||||||
Marshal.dump cache, io
|
Marshal.dump cache, io
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -441,7 +442,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
Dir.mkdir @tmpdir
|
Dir.mkdir @tmpdir
|
||||||
|
|
||||||
open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
||||||
Marshal.dump cache, io
|
Marshal.dump cache, io
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -490,7 +491,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
Dir.mkdir @tmpdir
|
Dir.mkdir @tmpdir
|
||||||
|
|
||||||
open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io|
|
||||||
Marshal.dump cache, io
|
Marshal.dump cache, io
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -524,6 +525,15 @@ class TestRDocStore < XrefTestCase
|
||||||
assert_includes @s.classes_hash, 'Object'
|
assert_includes @s.classes_hash, 'Object'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_load_single_class
|
||||||
|
@s.save_class @c8_s1
|
||||||
|
@s.classes_hash.clear
|
||||||
|
|
||||||
|
assert_equal @c8_s1, @s.load_class('C8::S1')
|
||||||
|
|
||||||
|
assert_includes @s.classes_hash, 'C8::S1'
|
||||||
|
end
|
||||||
|
|
||||||
def test_load_method
|
def test_load_method
|
||||||
@s.save_method @klass, @meth_bang
|
@s.save_method @klass, @meth_bang
|
||||||
|
|
||||||
|
@ -538,7 +548,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
file = @s.method_file @klass.full_name, @meth.full_name
|
file = @s.method_file @klass.full_name, @meth.full_name
|
||||||
|
|
||||||
open file, 'wb' do |io|
|
File.open file, 'wb' do |io|
|
||||||
io.write "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" +
|
io.write "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" +
|
||||||
"\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" +
|
"\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" +
|
||||||
"o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
|
"o:\eRDoc::Markup::Document\x06:\v@parts[\x06" +
|
||||||
|
@ -563,7 +573,7 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_main
|
def test_main
|
||||||
assert_equal nil, @s.main
|
assert_nil @s.main
|
||||||
|
|
||||||
@s.main = 'README.txt'
|
@s.main = 'README.txt'
|
||||||
|
|
||||||
|
@ -633,7 +643,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
expected[:ancestors]['Object'] = %w[BasicObject]
|
expected[:ancestors]['Object'] = %w[BasicObject]
|
||||||
|
|
||||||
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
File.open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
||||||
cache = Marshal.load io.read
|
cache = Marshal.load io.read
|
||||||
|
|
||||||
assert_equal expected, cache
|
assert_equal expected, cache
|
||||||
|
@ -701,7 +711,7 @@ class TestRDocStore < XrefTestCase
|
||||||
|
|
||||||
expected[:ancestors]['Object'] = %w[BasicObject]
|
expected[:ancestors]['Object'] = %w[BasicObject]
|
||||||
|
|
||||||
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
File.open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
||||||
cache = Marshal.load io.read
|
cache = Marshal.load io.read
|
||||||
|
|
||||||
assert_equal expected, cache
|
assert_equal expected, cache
|
||||||
|
@ -981,7 +991,7 @@ class TestRDocStore < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_title
|
def test_title
|
||||||
assert_equal nil, @s.title
|
assert_nil @s.title
|
||||||
|
|
||||||
@s.title = 'rdoc'
|
@s.title = 'rdoc'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
begin
|
begin
|
||||||
require 'rake'
|
require 'rake'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
require 'timeout'
|
||||||
|
|
||||||
class TestRDocText < RDoc::TestCase
|
class TestRDocText < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -377,6 +378,32 @@ paragraph will be cut off …
|
||||||
assert_equal expected, strip_stars(text)
|
assert_equal expected, strip_stars(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_strip_stars_document_method_special
|
||||||
|
text = <<-TEXT
|
||||||
|
/*
|
||||||
|
* Document-method: Zlib::GzipFile#mtime=
|
||||||
|
* Document-method: []
|
||||||
|
* Document-method: `
|
||||||
|
* Document-method: |
|
||||||
|
* Document-method: &
|
||||||
|
* Document-method: <=>
|
||||||
|
* Document-method: =~
|
||||||
|
* Document-method: +
|
||||||
|
* Document-method: -
|
||||||
|
* Document-method: +@
|
||||||
|
*
|
||||||
|
* A comment
|
||||||
|
*/
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
expected = <<-EXPECTED
|
||||||
|
|
||||||
|
A comment
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
assert_equal expected, strip_stars(text)
|
||||||
|
end
|
||||||
|
|
||||||
def test_strip_stars_encoding
|
def test_strip_stars_encoding
|
||||||
text = <<-TEXT
|
text = <<-TEXT
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocTokenStream < RDoc::TestCase
|
class TestRDocTokenStream < RDoc::TestCase
|
||||||
|
|
||||||
|
@ -39,5 +39,20 @@ class TestRDocTokenStream < RDoc::TestCase
|
||||||
assert_equal '', RDoc::TokenStream.to_html([])
|
assert_equal '', RDoc::TokenStream.to_html([])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_tokens_to_s
|
||||||
|
foo = Class.new do
|
||||||
|
include RDoc::TokenStream
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@token_stream = [
|
||||||
|
{ line_no: 0, char_no: 0, kind: :on_ident, text: "foo" },
|
||||||
|
{ line_no: 0, char_no: 0, kind: :on_sp, text: " " },
|
||||||
|
{ line_no: 0, char_no: 0, kind: :on_tstring, text: "'bar'" },
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end.new
|
||||||
|
|
||||||
|
assert_equal "foo 'bar'", foo.tokens_to_s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'rdoc/test_case'
|
require 'minitest_helper'
|
||||||
|
|
||||||
class TestRDocTomDoc < RDoc::TestCase
|
class TestRDocTomDoc < RDoc::TestCase
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ class TestRDocTopLevel < XrefTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_last_modified
|
def test_last_modified
|
||||||
assert_equal nil, @top_level.last_modified
|
assert_nil @top_level.last_modified
|
||||||
stat = Object.new
|
stat = Object.new
|
||||||
def stat.mtime() 0 end
|
def stat.mtime() 0 end
|
||||||
@top_level.file_stat = stat
|
@top_level.file_stat = stat
|
||||||
|
|
|
@ -94,6 +94,13 @@ class C7
|
||||||
CONST_NODOC = :const_nodoc # :nodoc:
|
CONST_NODOC = :const_nodoc # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class C8
|
||||||
|
class << self
|
||||||
|
class S1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module M1
|
module M1
|
||||||
def m
|
def m
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
ENV['RDOC_TEST'] = 'yes'
|
ENV['RDOC_TEST'] = 'yes'
|
||||||
|
|
||||||
require 'rdoc'
|
require 'minitest_helper'
|
||||||
require File.expand_path '../xref_data', __FILE__
|
require File.expand_path '../xref_data', __FILE__
|
||||||
|
|
||||||
class XrefTestCase < RDoc::TestCase
|
class XrefTestCase < RDoc::TestCase
|
||||||
|
@ -53,6 +53,8 @@ class XrefTestCase < RDoc::TestCase
|
||||||
@c3_h2 = @xref_data.find_module_named 'C3::H2'
|
@c3_h2 = @xref_data.find_module_named 'C3::H2'
|
||||||
@c6 = @xref_data.find_module_named 'C6'
|
@c6 = @xref_data.find_module_named 'C6'
|
||||||
@c7 = @xref_data.find_module_named 'C7'
|
@c7 = @xref_data.find_module_named 'C7'
|
||||||
|
@c8 = @xref_data.find_module_named 'C8'
|
||||||
|
@c8_s1 = @xref_data.find_module_named 'C8::S1'
|
||||||
|
|
||||||
@m1 = @xref_data.find_module_named 'M1'
|
@m1 = @xref_data.find_module_named 'M1'
|
||||||
@m1_m = @m1.method_list.first
|
@m1_m = @m1.method_list.first
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue