1ENV['RDOC_TEST'] = 'yes'
2
3require 'rdoc'
4require File.expand_path '../xref_data', __FILE__
5
6class XrefTestCase < RDoc::TestCase
7
8  def setup
9    super
10
11    @options = RDoc::Options.new
12    @options.quiet = true
13
14    @file_name = 'xref_data.rb'
15    @xref_data = @store.add_file @file_name
16    @top_level = @xref_data
17
18    stats = RDoc::Stats.new @store, 0
19
20    parser = RDoc::Parser::Ruby.new @xref_data, @file_name, XREF_DATA, @options,
21                                    stats
22    @top_levels = []
23    @top_levels.push parser.scan
24
25    generator = Object.new
26    def generator.class_dir() nil end
27    def generator.file_dir() nil end
28    @rdoc.options = @options
29    @rdoc.generator = generator
30
31    @c1    = @xref_data.find_module_named 'C1'
32    @c1_m  = @c1.method_list.last  # C1#m
33    @c1__m = @c1.method_list.first # C1::m
34
35    @c2    = @xref_data.find_module_named 'C2'
36    @c2_a  = @c2.method_list.last
37    @c2_b  = @c2.method_list.first
38
39    @c2_c3 = @xref_data.find_module_named 'C2::C3'
40    @c2_c3_m = @c2_c3.method_list.first # C2::C3#m
41
42    @c2_c3_h1 = @xref_data.find_module_named 'C2::C3::H1'
43    @c2_c3_h1_meh = @c2_c3_h1.method_list.first # C2::C3::H1#m?
44
45    @c3    = @xref_data.find_module_named 'C3'
46    @c4    = @xref_data.find_module_named 'C4'
47    @c4_c4 = @xref_data.find_module_named 'C4::C4'
48    @c5_c1 = @xref_data.find_module_named 'C5::C1'
49    @c3_h1 = @xref_data.find_module_named 'C3::H1'
50    @c3_h2 = @xref_data.find_module_named 'C3::H2'
51
52    @m1    = @xref_data.find_module_named 'M1'
53    @m1_m  = @m1.method_list.first
54
55    @m1_m2 = @xref_data.find_module_named 'M1::M2'
56
57    @parent = @xref_data.find_module_named 'Parent'
58    @child  = @xref_data.find_module_named 'Child'
59
60    @parent_m  = @parent.method_list.first # Parent#m
61    @parent__m = @parent.method_list.last  # Parent::m
62  end
63
64end
65
66