2017-11-27 05:45:24 -05:00
|
|
|
# frozen_string_literal: true
|
2010-04-01 03:45:16 -04:00
|
|
|
ENV['RDOC_TEST'] = 'yes'
|
|
|
|
|
2019-08-08 10:09:24 -04:00
|
|
|
require_relative 'helper'
|
2010-04-01 03:45:16 -04:00
|
|
|
require File.expand_path '../xref_data', __FILE__
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
class XrefTestCase < RDoc::TestCase
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
def setup
|
2012-11-26 23:28:14 -05:00
|
|
|
super
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
@options = RDoc::Options.new
|
|
|
|
@options.quiet = true
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
@rdoc.options = @options
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
@file_name = 'xref_data.rb'
|
|
|
|
@xref_data = @store.add_file @file_name
|
|
|
|
@top_level = @xref_data
|
|
|
|
|
|
|
|
stats = RDoc::Stats.new @store, 0
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
parser = RDoc::Parser::Ruby.new @xref_data, @file_name, XREF_DATA, @options,
|
|
|
|
stats
|
2019-08-08 03:35:34 -04:00
|
|
|
|
|
|
|
@example_md = @store.add_file 'EXAMPLE.md'
|
|
|
|
@example_md.parser = RDoc::Parser::Markdown
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@top_levels = []
|
|
|
|
@top_levels.push parser.scan
|
2019-08-08 03:35:34 -04:00
|
|
|
@top_levels.push @example_md
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
generator = Object.new
|
|
|
|
def generator.class_dir() nil end
|
|
|
|
def generator.file_dir() nil end
|
2012-11-26 23:28:14 -05:00
|
|
|
@rdoc.options = @options
|
|
|
|
@rdoc.generator = generator
|
2010-04-01 03:45:16 -04:00
|
|
|
|
2018-08-26 21:30:18 -04:00
|
|
|
@c1 = @xref_data.find_module_named 'C1'
|
|
|
|
@c1__m = @c1.find_class_method_named 'm' # C1::m
|
|
|
|
@c1_m = @c1.find_instance_method_named 'm' # C1#m
|
|
|
|
@c1_plus = @c1.find_instance_method_named '+'
|
2010-04-19 01:08:28 -04:00
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@c2 = @xref_data.find_module_named 'C2'
|
2010-12-19 22:22:49 -05:00
|
|
|
@c2_a = @c2.method_list.last
|
|
|
|
@c2_b = @c2.method_list.first
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@c2_c3 = @xref_data.find_module_named 'C2::C3'
|
2011-07-30 20:19:00 -04:00
|
|
|
@c2_c3_m = @c2_c3.method_list.first # C2::C3#m
|
|
|
|
|
|
|
|
@c2_c3_h1 = @xref_data.find_module_named 'C2::C3::H1'
|
|
|
|
@c2_c3_h1_meh = @c2_c3_h1.method_list.first # C2::C3::H1#m?
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@c3 = @xref_data.find_module_named 'C3'
|
|
|
|
@c4 = @xref_data.find_module_named 'C4'
|
|
|
|
@c4_c4 = @xref_data.find_module_named 'C4::C4'
|
|
|
|
@c5_c1 = @xref_data.find_module_named 'C5::C1'
|
|
|
|
@c3_h1 = @xref_data.find_module_named 'C3::H1'
|
|
|
|
@c3_h2 = @xref_data.find_module_named 'C3::H2'
|
2017-02-24 02:39:37 -05:00
|
|
|
@c6 = @xref_data.find_module_named 'C6'
|
2017-08-29 07:52:50 -04:00
|
|
|
@c7 = @xref_data.find_module_named 'C7'
|
2018-03-26 01:56:26 -04:00
|
|
|
@c8 = @xref_data.find_module_named 'C8'
|
|
|
|
@c8_s1 = @xref_data.find_module_named 'C8::S1'
|
2010-04-01 03:45:16 -04:00
|
|
|
|
2018-08-26 21:30:18 -04:00
|
|
|
@c9 = @xref_data.find_module_named 'C9'
|
|
|
|
@c9_a = @xref_data.find_module_named 'C9::A'
|
|
|
|
@c9_a_i_foo = @c9_a.method_list.first
|
|
|
|
@c9_a_c_bar = @c9_a.method_list.last
|
|
|
|
@c9_b = @xref_data.find_module_named 'C9::B'
|
|
|
|
@c9_b_c_foo = @c9_b.method_list.first
|
|
|
|
@c9_b_i_bar = @c9_b.method_list.last
|
|
|
|
|
2021-12-04 04:05:37 -05:00
|
|
|
@object = @xref_data.find_module_named 'Object'
|
|
|
|
@c10_class = @xref_data.find_module_named 'C10'
|
|
|
|
@c10_method = @object.find_method_named 'C10'
|
|
|
|
@c11_class = @xref_data.find_module_named 'C11'
|
|
|
|
@c10_c11_class = @c10_class.find_module_named 'C11'
|
|
|
|
@c10_c11_method = @c10_class.find_method_named 'C11'
|
|
|
|
@c11_method = @object.find_method_named 'C11'
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@m1 = @xref_data.find_module_named 'M1'
|
2010-12-19 22:22:49 -05:00
|
|
|
@m1_m = @m1.method_list.first
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@m1_m2 = @xref_data.find_module_named 'M1::M2'
|
2011-05-13 20:39:16 -04:00
|
|
|
|
|
|
|
@parent = @xref_data.find_module_named 'Parent'
|
|
|
|
@child = @xref_data.find_module_named 'Child'
|
|
|
|
|
|
|
|
@parent_m = @parent.method_list.first # Parent#m
|
|
|
|
@parent__m = @parent.method_list.last # Parent::m
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|