rdoc 4.3.0 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/.travis.yml +23 -0
- data/CONTRIBUTING.rdoc +4 -3
- data/Gemfile +3 -0
- data/History.rdoc +15 -4
- data/LEGAL.rdoc +2 -2
- data/README.rdoc +1 -0
- data/Rakefile +41 -79
- data/bin/console +7 -0
- data/bin/setup +6 -0
- data/{bin → exe}/rdoc +0 -0
- data/{bin → exe}/ri +0 -0
- data/lib/rdoc.rb +2 -1
- data/lib/rdoc/alias.rb +1 -0
- data/lib/rdoc/anon_class.rb +1 -0
- data/lib/rdoc/any_method.rb +1 -0
- data/lib/rdoc/attr.rb +1 -0
- data/lib/rdoc/class_module.rb +1 -0
- data/lib/rdoc/code_object.rb +1 -0
- data/lib/rdoc/code_objects.rb +1 -0
- data/lib/rdoc/comment.rb +1 -0
- data/lib/rdoc/constant.rb +1 -0
- data/lib/rdoc/context.rb +4 -1
- data/lib/rdoc/context/section.rb +7 -0
- data/lib/rdoc/cross_reference.rb +1 -0
- data/lib/rdoc/encoding.rb +14 -0
- data/lib/rdoc/erb_partial.rb +1 -0
- data/lib/rdoc/erbio.rb +1 -0
- data/lib/rdoc/extend.rb +1 -0
- data/lib/rdoc/generator.rb +1 -0
- data/lib/rdoc/generator/darkfish.rb +1 -0
- data/lib/rdoc/generator/json_index.rb +1 -0
- data/lib/rdoc/generator/markup.rb +1 -0
- data/lib/rdoc/generator/pot.rb +1 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -0
- data/lib/rdoc/generator/pot/po.rb +1 -0
- data/lib/rdoc/generator/pot/po_entry.rb +1 -0
- data/lib/rdoc/generator/ri.rb +1 -0
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/css/fonts.css +6 -6
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -7
- data/lib/rdoc/generator/template/json_index/js/searcher.js +1 -0
- data/lib/rdoc/ghost_method.rb +1 -0
- data/lib/rdoc/i18n.rb +1 -0
- data/lib/rdoc/i18n/locale.rb +1 -0
- data/lib/rdoc/i18n/text.rb +1 -0
- data/lib/rdoc/include.rb +1 -0
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markdown.kpeg +2 -6
- data/lib/rdoc/markdown.rb +2 -6
- data/lib/rdoc/markdown/entities.rb +1 -0
- data/lib/rdoc/markdown/{literals_1_9.kpeg → literals.kpeg} +0 -0
- data/lib/rdoc/markdown/{literals_1_9.rb → literals.rb} +1 -4
- data/lib/rdoc/markup.rb +1 -0
- data/lib/rdoc/markup/attr_changer.rb +1 -0
- data/lib/rdoc/markup/attr_span.rb +1 -0
- data/lib/rdoc/markup/attribute_manager.rb +1 -0
- data/lib/rdoc/markup/attributes.rb +1 -0
- data/lib/rdoc/markup/blank_line.rb +1 -0
- data/lib/rdoc/markup/block_quote.rb +1 -0
- data/lib/rdoc/markup/document.rb +1 -0
- data/lib/rdoc/markup/formatter.rb +1 -0
- data/lib/rdoc/markup/formatter_test_case.rb +1 -4
- data/lib/rdoc/markup/hard_break.rb +1 -0
- data/lib/rdoc/markup/heading.rb +1 -0
- data/lib/rdoc/markup/include.rb +1 -0
- data/lib/rdoc/markup/indented_paragraph.rb +1 -0
- data/lib/rdoc/markup/inline.rb +1 -0
- data/lib/rdoc/markup/list.rb +1 -0
- data/lib/rdoc/markup/list_item.rb +1 -0
- data/lib/rdoc/markup/paragraph.rb +1 -0
- data/lib/rdoc/markup/parser.rb +1 -0
- data/lib/rdoc/markup/pre_process.rb +1 -0
- data/lib/rdoc/markup/raw.rb +1 -0
- data/lib/rdoc/markup/rule.rb +1 -0
- data/lib/rdoc/markup/special.rb +1 -0
- data/lib/rdoc/markup/text_formatter_test_case.rb +1 -0
- data/lib/rdoc/markup/to_ansi.rb +1 -0
- data/lib/rdoc/markup/to_bs.rb +1 -0
- data/lib/rdoc/markup/to_html.rb +1 -0
- data/lib/rdoc/markup/to_html_crossref.rb +1 -0
- data/lib/rdoc/markup/to_html_snippet.rb +1 -0
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
- data/lib/rdoc/markup/to_label.rb +1 -0
- data/lib/rdoc/markup/to_markdown.rb +1 -0
- data/lib/rdoc/markup/to_rdoc.rb +1 -0
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
- data/lib/rdoc/markup/to_test.rb +1 -0
- data/lib/rdoc/markup/to_tt_only.rb +1 -0
- data/lib/rdoc/markup/verbatim.rb +1 -0
- data/lib/rdoc/meta_method.rb +1 -0
- data/lib/rdoc/method_attr.rb +1 -0
- data/lib/rdoc/mixin.rb +1 -0
- data/lib/rdoc/normal_class.rb +1 -0
- data/lib/rdoc/normal_module.rb +1 -0
- data/lib/rdoc/options.rb +1 -0
- data/lib/rdoc/parser.rb +1 -0
- data/lib/rdoc/parser/c.rb +76 -33
- data/lib/rdoc/parser/changelog.rb +7 -1
- data/lib/rdoc/parser/markdown.rb +1 -0
- data/lib/rdoc/parser/rd.rb +1 -0
- data/lib/rdoc/parser/ruby.rb +1 -0
- data/lib/rdoc/parser/ruby_tools.rb +1 -0
- data/lib/rdoc/parser/simple.rb +1 -0
- data/lib/rdoc/parser/text.rb +1 -0
- data/lib/rdoc/rd.rb +1 -0
- data/lib/rdoc/rd/inline.rb +1 -0
- data/lib/rdoc/rdoc.rb +2 -1
- data/lib/rdoc/require.rb +1 -0
- data/lib/rdoc/ri.rb +1 -0
- data/lib/rdoc/ri/driver.rb +5 -19
- data/lib/rdoc/ri/formatter.rb +1 -0
- data/lib/rdoc/ri/paths.rb +1 -0
- data/lib/rdoc/ri/store.rb +1 -0
- data/lib/rdoc/ri/task.rb +72 -0
- data/lib/rdoc/ruby_lex.rb +11 -17
- data/lib/rdoc/ruby_token.rb +1 -0
- data/lib/rdoc/rubygems_hook.rb +1 -0
- data/lib/rdoc/servlet.rb +4 -3
- data/lib/rdoc/single_class.rb +1 -0
- data/lib/rdoc/stats.rb +1 -0
- data/lib/rdoc/stats/normal.rb +1 -0
- data/lib/rdoc/stats/quiet.rb +1 -0
- data/lib/rdoc/stats/verbose.rb +1 -0
- data/lib/rdoc/store.rb +3 -9
- data/lib/rdoc/task.rb +1 -0
- data/lib/rdoc/test_case.rb +1 -10
- data/lib/rdoc/text.rb +1 -0
- data/lib/rdoc/token_stream.rb +1 -0
- data/lib/rdoc/tom_doc.rb +1 -0
- data/lib/rdoc/top_level.rb +1 -0
- data/rdoc.gemspec +60 -0
- metadata +32 -155
- data/Manifest.txt +0 -309
- data/lib/rdoc/markdown/literals_1_8.kpeg +0 -18
- data/lib/rdoc/markdown/literals_1_8.rb +0 -416
- data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +0 -21
- data/test/MarkdownTest_1.0.3/Auto links.text +0 -13
- data/test/MarkdownTest_1.0.3/Backslash escapes.text +0 -120
- data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +0 -11
- data/test/MarkdownTest_1.0.3/Code Blocks.text +0 -14
- data/test/MarkdownTest_1.0.3/Code Spans.text +0 -6
- data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +0 -8
- data/test/MarkdownTest_1.0.3/Horizontal rules.text +0 -67
- data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +0 -15
- data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +0 -69
- data/test/MarkdownTest_1.0.3/Inline HTML comments.text +0 -13
- data/test/MarkdownTest_1.0.3/Links, inline style.text +0 -12
- data/test/MarkdownTest_1.0.3/Links, reference style.text +0 -71
- data/test/MarkdownTest_1.0.3/Links, shortcut references.text +0 -20
- data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +0 -7
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +0 -306
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +0 -888
- data/test/MarkdownTest_1.0.3/Nested blockquotes.text +0 -5
- data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +0 -131
- data/test/MarkdownTest_1.0.3/Strong and em together.text +0 -7
- data/test/MarkdownTest_1.0.3/Tabs.text +0 -21
- data/test/MarkdownTest_1.0.3/Tidyness.text +0 -5
- data/test/README +0 -1
- data/test/binary.dat +0 -0
- data/test/hidden.zip.txt +0 -1
- data/test/test.ja.largedoc +0 -3
- data/test/test.ja.rdoc +0 -10
- data/test/test.ja.txt +0 -8
- data/test/test.txt +0 -1
- data/test/test_rdoc_alias.rb +0 -13
- data/test/test_rdoc_any_method.rb +0 -460
- data/test/test_rdoc_attr.rb +0 -190
- data/test/test_rdoc_class_module.rb +0 -1492
- data/test/test_rdoc_code_object.rb +0 -450
- data/test/test_rdoc_comment.rb +0 -504
- data/test/test_rdoc_constant.rb +0 -181
- data/test/test_rdoc_context.rb +0 -901
- data/test/test_rdoc_context_section.rb +0 -130
- data/test/test_rdoc_cross_reference.rb +0 -192
- data/test/test_rdoc_encoding.rb +0 -227
- data/test/test_rdoc_extend.rb +0 -94
- data/test/test_rdoc_generator_darkfish.rb +0 -229
- data/test/test_rdoc_generator_json_index.rb +0 -324
- data/test/test_rdoc_generator_markup.rb +0 -59
- data/test/test_rdoc_generator_pot.rb +0 -91
- data/test/test_rdoc_generator_pot_po.rb +0 -51
- data/test/test_rdoc_generator_pot_po_entry.rb +0 -139
- data/test/test_rdoc_generator_ri.rb +0 -78
- data/test/test_rdoc_i18n_locale.rb +0 -73
- data/test/test_rdoc_i18n_text.rb +0 -123
- data/test/test_rdoc_include.rb +0 -108
- data/test/test_rdoc_markdown.rb +0 -980
- data/test/test_rdoc_markdown_test.rb +0 -1884
- data/test/test_rdoc_markup.rb +0 -95
- data/test/test_rdoc_markup_attribute_manager.rb +0 -364
- data/test/test_rdoc_markup_attributes.rb +0 -39
- data/test/test_rdoc_markup_document.rb +0 -207
- data/test/test_rdoc_markup_formatter.rb +0 -175
- data/test/test_rdoc_markup_hard_break.rb +0 -31
- data/test/test_rdoc_markup_heading.rb +0 -29
- data/test/test_rdoc_markup_include.rb +0 -19
- data/test/test_rdoc_markup_indented_paragraph.rb +0 -53
- data/test/test_rdoc_markup_paragraph.rb +0 -32
- data/test/test_rdoc_markup_parser.rb +0 -1680
- data/test/test_rdoc_markup_pre_process.rb +0 -473
- data/test/test_rdoc_markup_raw.rb +0 -22
- data/test/test_rdoc_markup_to_ansi.rb +0 -369
- data/test/test_rdoc_markup_to_bs.rb +0 -366
- data/test/test_rdoc_markup_to_html.rb +0 -662
- data/test/test_rdoc_markup_to_html_crossref.rb +0 -225
- data/test/test_rdoc_markup_to_html_snippet.rb +0 -711
- data/test/test_rdoc_markup_to_joined_paragraph.rb +0 -32
- data/test/test_rdoc_markup_to_label.rb +0 -112
- data/test/test_rdoc_markup_to_markdown.rb +0 -389
- data/test/test_rdoc_markup_to_rdoc.rb +0 -377
- data/test/test_rdoc_markup_to_table_of_contents.rb +0 -126
- data/test/test_rdoc_markup_to_tt_only.rb +0 -246
- data/test/test_rdoc_markup_verbatim.rb +0 -29
- data/test/test_rdoc_method_attr.rb +0 -193
- data/test/test_rdoc_normal_class.rb +0 -47
- data/test/test_rdoc_normal_module.rb +0 -42
- data/test/test_rdoc_options.rb +0 -766
- data/test/test_rdoc_parser.rb +0 -327
- data/test/test_rdoc_parser_c.rb +0 -1896
- data/test/test_rdoc_parser_changelog.rb +0 -315
- data/test/test_rdoc_parser_markdown.rb +0 -61
- data/test/test_rdoc_parser_rd.rb +0 -55
- data/test/test_rdoc_parser_ruby.rb +0 -3322
- data/test/test_rdoc_parser_simple.rb +0 -115
- data/test/test_rdoc_rd.rb +0 -30
- data/test/test_rdoc_rd_block_parser.rb +0 -535
- data/test/test_rdoc_rd_inline.rb +0 -63
- data/test/test_rdoc_rd_inline_parser.rb +0 -177
- data/test/test_rdoc_rdoc.rb +0 -455
- data/test/test_rdoc_require.rb +0 -25
- data/test/test_rdoc_ri_driver.rb +0 -1436
- data/test/test_rdoc_ri_paths.rb +0 -155
- data/test/test_rdoc_ruby_lex.rb +0 -421
- data/test/test_rdoc_ruby_token.rb +0 -19
- data/test/test_rdoc_rubygems_hook.rb +0 -251
- data/test/test_rdoc_servlet.rb +0 -534
- data/test/test_rdoc_single_class.rb +0 -20
- data/test/test_rdoc_stats.rb +0 -722
- data/test/test_rdoc_store.rb +0 -993
- data/test/test_rdoc_task.rb +0 -173
- data/test/test_rdoc_text.rb +0 -557
- data/test/test_rdoc_token_stream.rb +0 -42
- data/test/test_rdoc_tom_doc.rb +0 -520
- data/test/test_rdoc_top_level.rb +0 -287
- data/test/xref_data.rb +0 -76
- data/test/xref_test_case.rb +0 -67
data/test/test_rdoc_rd_inline.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'rdoc/test_case'
|
2
|
-
|
3
|
-
class TestRDocRdInline < RDoc::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@inline = RDoc::RD::Inline.new '+text+', 'text'
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_class_new
|
12
|
-
inline = RDoc::RD::Inline.new @inline
|
13
|
-
|
14
|
-
refute_equal inline.rdoc, inline.reference
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_initialize
|
18
|
-
inline = RDoc::RD::Inline.new 'text'
|
19
|
-
|
20
|
-
assert_equal inline.rdoc, inline.reference
|
21
|
-
refute_same inline.rdoc, inline.reference
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_initialize_inline
|
25
|
-
inline = RDoc::RD::Inline.new @inline
|
26
|
-
|
27
|
-
assert_equal '+text+', inline.rdoc
|
28
|
-
assert_equal 'text', inline.reference
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_append_inline
|
32
|
-
out = @inline.append @inline
|
33
|
-
|
34
|
-
assert_same @inline, out
|
35
|
-
|
36
|
-
assert_equal '+text++text+', @inline.rdoc
|
37
|
-
assert_equal 'texttext', @inline.reference
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_append_string
|
41
|
-
@inline.append ' more'
|
42
|
-
|
43
|
-
assert_equal '+text+ more', @inline.rdoc
|
44
|
-
assert_equal 'text more', @inline.reference
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_equals2
|
48
|
-
assert_equal @inline, RDoc::RD::Inline.new('+text+', 'text')
|
49
|
-
refute_equal @inline, RDoc::RD::Inline.new('+text+', 'other')
|
50
|
-
refute_equal @inline, RDoc::RD::Inline.new('+other+', 'text')
|
51
|
-
refute_equal @inline, Object.new
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_inspect
|
55
|
-
assert_equal '(inline: +text+)', @inline.inspect
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_to_s
|
59
|
-
assert_equal '+text+', @inline.to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
@@ -1,177 +0,0 @@
|
|
1
|
-
require 'rdoc/test_case'
|
2
|
-
|
3
|
-
class TestRDocRdInlineParser < RDoc::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@block_parser = RDoc::RD::BlockParser.new
|
9
|
-
@block_parser.instance_variable_set :@i, 0
|
10
|
-
@inline_parser = RDoc::RD::InlineParser.new @block_parser
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_parse
|
14
|
-
assert_equal 'regular <em>emphasis</em>', parse('regular ((*emphasis*))')
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_parse_code
|
18
|
-
assert_equal '<code>text</code>', parse('(({text}))')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_parse_em
|
22
|
-
assert_equal '<em>text</em>', parse('((*text*))')
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_parse_footnote
|
26
|
-
assert_equal '{*1}[rdoc-label:foottext-1:footmark-1]', parse('((-text-))')
|
27
|
-
|
28
|
-
expected = [
|
29
|
-
@RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', ' ', 'text'),
|
30
|
-
blank_line,
|
31
|
-
]
|
32
|
-
|
33
|
-
assert_equal expected, @block_parser.footnotes
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_parse_index
|
37
|
-
assert_equal '<span id="label-text">text</span>', parse('((:text:))')
|
38
|
-
|
39
|
-
assert_includes @block_parser.labels, 'text'
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_parse_kbd
|
43
|
-
assert_equal '<tt>text</tt>', parse('((%text%))')
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_parse_multiple
|
47
|
-
assert_equal '<em>one</em> <em>two</em>', parse('((*one*)) ((*two*))')
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_parse_newline
|
51
|
-
assert_equal "one\ntwo", parse("one\ntwo")
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_parse_quote
|
55
|
-
assert_equal 'one " two', parse('one " two')
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_parse_ref
|
59
|
-
assert_equal '{text}[rdoc-label:text]', parse('((<text>))')
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_parse_ref_em
|
63
|
-
assert_equal '{<em>text</em>}[rdoc-label:text]', parse('((<((*text*))>))')
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_parse_ref_filename_quote
|
67
|
-
assert_equal '{RD/foo}[rdoc-label:RD/foo]', parse('((<RD/"foo">))')
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_parse_ref_filename
|
71
|
-
assert_equal '{RD}[rdoc-label:RD/]', parse('((<RD/>))')
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_parse_ref_quote
|
75
|
-
assert_equal '{text \\"}[rdoc-label:text \\"]', parse('((<text \">))')
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_parse_ref_quote_content
|
79
|
-
assert_equal '{<em>text</em>}[rdoc-label:text]',
|
80
|
-
parse('((<"((*text*))">))')
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_parse_ref_quote_content_multi
|
84
|
-
assert_equal '{<em>one</em> <em>two</em>}[rdoc-label:one two]',
|
85
|
-
parse('((<"((*one*)) ((*two*))">))')
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_parse_ref_substitute
|
89
|
-
assert_equal '{text}[rdoc-label:thing]', parse('((<text|thing>))')
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_parse_ref_substitute_element_quote
|
93
|
-
assert_equal '{text}[rdoc-label:"RD"]',
|
94
|
-
parse('((<text|"RD">))')
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_parse_ref_substitute_filename
|
98
|
-
assert_equal '{text}[rdoc-label:RD/]', parse('((<text|RD/>))')
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_parse_ref_substitute_filename_label
|
102
|
-
assert_equal '{text}[rdoc-label:RD/label]',
|
103
|
-
parse('((<text|RD/label>))')
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_parse_ref_substitute_filename_quote
|
107
|
-
assert_equal '{text}[rdoc-label:"RD"/]', parse('((<text|"RD"/>))')
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_parse_ref_substitute_multi_content
|
111
|
-
assert_equal '{<em>one</em> two}[rdoc-label:thing]',
|
112
|
-
parse('((<((*one*)) two|thing>))')
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_parse_ref_substitute_multi_content2
|
116
|
-
assert_equal '{<em>one</em> \\" two}[rdoc-label:thing]',
|
117
|
-
parse('((<((*one*)) \" two|thing>))')
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_parse_ref_substitute_multi_content3
|
121
|
-
assert_equal '{<em>one</em> \\" <em>two</em>}[rdoc-label:thing]',
|
122
|
-
parse('((<((*one*)) \" ((*two*))|thing>))')
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_parse_ref_substitute_quote
|
126
|
-
assert_equal '{one | two}[rdoc-label:thing]',
|
127
|
-
parse('((<"one | two"|thing>))')
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_parse_ref_substitute_quote_content
|
131
|
-
assert_equal '{<em>text</em>}[rdoc-label:thing]',
|
132
|
-
parse('((<"((*text*))"|thing>))')
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_parse_ref_substitute_url
|
136
|
-
assert_equal '{text}[http://example]',
|
137
|
-
parse('((<text|URL:http://example>))')
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_parse_ref_url
|
141
|
-
assert_equal '{http://example}[http://example]',
|
142
|
-
parse('((<URL:http://example>))')
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_parse_var
|
146
|
-
assert_equal '+text+', parse('((|text|))')
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_parse_verb
|
150
|
-
assert_equal '<tt>text</tt>', parse("(('text'))")
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_parse_verb_backslash
|
154
|
-
assert_equal "<tt>(('text'))</tt>", parse("(('(('text\\'))'))")
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_parse_verb_backslash_backslash
|
158
|
-
assert_equal '<tt>text \\</tt>', parse("(('text \\\\'))")
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_parse_verb_backslash_quote
|
162
|
-
assert_equal '<tt>text "</tt>', parse("(('text \\\"'))")
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_parse_verb_emphasis
|
166
|
-
assert_equal '<tt>((*emphasis*))</tt>', parse("(('((*emphasis*))'))")
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_parse_verb_multiple
|
170
|
-
assert_equal '<tt>((*text*))</tt>', parse("(('((*text*))'))")
|
171
|
-
end
|
172
|
-
|
173
|
-
def parse text
|
174
|
-
@inline_parser.parse text
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
data/test/test_rdoc_rdoc.rb
DELETED
@@ -1,455 +0,0 @@
|
|
1
|
-
require 'rdoc/test_case'
|
2
|
-
|
3
|
-
class TestRDocRDoc < RDoc::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
super
|
7
|
-
|
8
|
-
@rdoc = RDoc::RDoc.new
|
9
|
-
@rdoc.options = RDoc::Options.new
|
10
|
-
|
11
|
-
@stats = RDoc::Stats.new @store, 0, 0
|
12
|
-
@rdoc.instance_variable_set :@stats, @stats
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_document # functional test
|
16
|
-
options = RDoc::Options.new
|
17
|
-
options.files = [File.expand_path('../xref_data.rb', __FILE__)]
|
18
|
-
options.setup_generator 'ri'
|
19
|
-
options.main_page = 'MAIN_PAGE.rdoc'
|
20
|
-
options.root = Pathname File.expand_path('..', __FILE__)
|
21
|
-
options.title = 'title'
|
22
|
-
|
23
|
-
rdoc = RDoc::RDoc.new
|
24
|
-
|
25
|
-
temp_dir do
|
26
|
-
options.op_dir = 'ri'
|
27
|
-
|
28
|
-
capture_io do
|
29
|
-
rdoc.document options
|
30
|
-
end
|
31
|
-
|
32
|
-
assert File.directory? 'ri'
|
33
|
-
assert_equal rdoc, rdoc.store.rdoc
|
34
|
-
end
|
35
|
-
|
36
|
-
store = rdoc.store
|
37
|
-
|
38
|
-
assert_equal 'MAIN_PAGE.rdoc', store.main
|
39
|
-
assert_equal 'title', store.title
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_gather_files
|
43
|
-
a = File.expand_path __FILE__
|
44
|
-
b = File.expand_path '../test_rdoc_text.rb', __FILE__
|
45
|
-
|
46
|
-
assert_equal [a, b], @rdoc.gather_files([b, a, b])
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_handle_pipe
|
50
|
-
$stdin = StringIO.new "hello"
|
51
|
-
|
52
|
-
out, = capture_io do
|
53
|
-
@rdoc.handle_pipe
|
54
|
-
end
|
55
|
-
|
56
|
-
assert_equal "\n<p>hello</p>\n", out
|
57
|
-
ensure
|
58
|
-
$stdin = STDIN
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_handle_pipe_rd
|
62
|
-
$stdin = StringIO.new "=begin\nhello\n=end"
|
63
|
-
|
64
|
-
@rdoc.options.markup = 'rd'
|
65
|
-
|
66
|
-
out, = capture_io do
|
67
|
-
@rdoc.handle_pipe
|
68
|
-
end
|
69
|
-
|
70
|
-
assert_equal "\n<p>hello</p>\n", out
|
71
|
-
ensure
|
72
|
-
$stdin = STDIN
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_load_options
|
76
|
-
temp_dir do
|
77
|
-
options = RDoc::Options.new
|
78
|
-
options.markup = 'tomdoc'
|
79
|
-
options.write_options
|
80
|
-
|
81
|
-
options = @rdoc.load_options
|
82
|
-
|
83
|
-
assert_equal 'tomdoc', options.markup
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_load_options_invalid
|
88
|
-
temp_dir do
|
89
|
-
open '.rdoc_options', 'w' do |io|
|
90
|
-
io.write "a: !ruby.yaml.org,2002:str |\nfoo"
|
91
|
-
end
|
92
|
-
|
93
|
-
e = assert_raises RDoc::Error do
|
94
|
-
@rdoc.load_options
|
95
|
-
end
|
96
|
-
|
97
|
-
options_file = File.expand_path '.rdoc_options'
|
98
|
-
assert_equal "#{options_file} is not a valid rdoc options file", e.message
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def load_options_no_file
|
103
|
-
temp_dir do
|
104
|
-
options = @rdoc.load_options
|
105
|
-
|
106
|
-
assert_kind_of RDoc::Options, options
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_normalized_file_list
|
111
|
-
files = temp_dir do |dir|
|
112
|
-
flag_file = @rdoc.output_flag_file dir
|
113
|
-
|
114
|
-
FileUtils.touch flag_file
|
115
|
-
|
116
|
-
@rdoc.normalized_file_list [__FILE__, flag_file]
|
117
|
-
end
|
118
|
-
|
119
|
-
files = files.map { |file| File.expand_path file }
|
120
|
-
|
121
|
-
assert_equal [File.expand_path(__FILE__)], files
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_normalized_file_list_not_modified
|
125
|
-
files = [__FILE__]
|
126
|
-
|
127
|
-
@rdoc.last_modified[__FILE__] = File.stat(__FILE__).mtime
|
128
|
-
|
129
|
-
files = @rdoc.normalized_file_list [__FILE__]
|
130
|
-
|
131
|
-
assert_empty files
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_normalized_file_list_non_file_directory
|
135
|
-
dev = defined?(File::NULL) ? File::NULL : '/dev/stdin'
|
136
|
-
skip "#{dev} is not a character special" unless
|
137
|
-
File.chardev? dev
|
138
|
-
|
139
|
-
files = nil
|
140
|
-
|
141
|
-
out, err = verbose_capture_io do
|
142
|
-
files = @rdoc.normalized_file_list [dev]
|
143
|
-
end
|
144
|
-
|
145
|
-
files = files.map { |file| File.expand_path file }
|
146
|
-
|
147
|
-
assert_empty files
|
148
|
-
|
149
|
-
assert_empty out
|
150
|
-
assert_match %r"^rdoc can't parse", err
|
151
|
-
assert_match %r"#{dev}$", err
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_parse_file
|
155
|
-
@rdoc.store = RDoc::Store.new
|
156
|
-
|
157
|
-
temp_dir do |dir|
|
158
|
-
@rdoc.options.root = Pathname(Dir.pwd)
|
159
|
-
|
160
|
-
open 'test.txt', 'w' do |io|
|
161
|
-
io.puts 'hi'
|
162
|
-
end
|
163
|
-
|
164
|
-
top_level = @rdoc.parse_file 'test.txt'
|
165
|
-
|
166
|
-
assert_equal 'test.txt', top_level.absolute_name
|
167
|
-
assert_equal 'test.txt', top_level.relative_name
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
def test_parse_file_binary
|
172
|
-
@rdoc.store = RDoc::Store.new
|
173
|
-
|
174
|
-
root = File.dirname __FILE__
|
175
|
-
|
176
|
-
@rdoc.options.root = Pathname root
|
177
|
-
|
178
|
-
out, err = capture_io do
|
179
|
-
Dir.chdir root do
|
180
|
-
assert_nil @rdoc.parse_file 'binary.dat'
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
assert_empty out
|
185
|
-
assert_empty err
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_parse_file_include_root
|
189
|
-
@rdoc.store = RDoc::Store.new
|
190
|
-
|
191
|
-
top_level = nil
|
192
|
-
temp_dir do |dir|
|
193
|
-
@rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
|
194
|
-
|
195
|
-
open 'include.txt', 'w' do |io|
|
196
|
-
io.puts ':include: test.txt'
|
197
|
-
end
|
198
|
-
|
199
|
-
out, err = capture_io do
|
200
|
-
top_level = @rdoc.parse_file 'include.txt'
|
201
|
-
end
|
202
|
-
assert_empty out
|
203
|
-
assert_empty err
|
204
|
-
end
|
205
|
-
assert_equal "test file", top_level.comment.text
|
206
|
-
end
|
207
|
-
|
208
|
-
def test_parse_file_page_dir
|
209
|
-
@rdoc.store = RDoc::Store.new
|
210
|
-
|
211
|
-
temp_dir do |dir|
|
212
|
-
FileUtils.mkdir 'pages'
|
213
|
-
@rdoc.options.page_dir = Pathname('pages')
|
214
|
-
@rdoc.options.root = Pathname(Dir.pwd)
|
215
|
-
|
216
|
-
open 'pages/test.txt', 'w' do |io|
|
217
|
-
io.puts 'hi'
|
218
|
-
end
|
219
|
-
|
220
|
-
top_level = @rdoc.parse_file 'pages/test.txt'
|
221
|
-
|
222
|
-
assert_equal 'pages/test.txt', top_level.absolute_name
|
223
|
-
assert_equal 'test.txt', top_level.relative_name
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_parse_file_relative
|
228
|
-
pwd = Dir.pwd
|
229
|
-
|
230
|
-
@rdoc.store = RDoc::Store.new
|
231
|
-
|
232
|
-
temp_dir do |dir|
|
233
|
-
@rdoc.options.root = Pathname(dir)
|
234
|
-
|
235
|
-
open 'test.txt', 'w' do |io|
|
236
|
-
io.puts 'hi'
|
237
|
-
end
|
238
|
-
|
239
|
-
test_txt = File.join dir, 'test.txt'
|
240
|
-
|
241
|
-
Dir.chdir pwd do
|
242
|
-
top_level = @rdoc.parse_file test_txt
|
243
|
-
|
244
|
-
assert_equal test_txt, top_level.absolute_name
|
245
|
-
assert_equal 'test.txt', top_level.relative_name
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
def test_parse_file_encoding
|
251
|
-
skip "Encoding not implemented" unless Object.const_defined? :Encoding
|
252
|
-
@rdoc.options.encoding = Encoding::ISO_8859_1
|
253
|
-
@rdoc.store = RDoc::Store.new
|
254
|
-
|
255
|
-
tf = Tempfile.open 'test.txt' do |io|
|
256
|
-
io.write 'hi'
|
257
|
-
io.rewind
|
258
|
-
|
259
|
-
top_level = @rdoc.parse_file io.path
|
260
|
-
|
261
|
-
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
|
262
|
-
io
|
263
|
-
end
|
264
|
-
tf.close! if tf.respond_to? :close!
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_parse_file_forbidden
|
268
|
-
skip 'chmod not supported' if Gem.win_platform?
|
269
|
-
|
270
|
-
@rdoc.store = RDoc::Store.new
|
271
|
-
|
272
|
-
tf = Tempfile.open 'test.txt' do |io|
|
273
|
-
io.write 'hi'
|
274
|
-
io.rewind
|
275
|
-
|
276
|
-
File.chmod 0000, io.path
|
277
|
-
|
278
|
-
begin
|
279
|
-
top_level = :bug
|
280
|
-
|
281
|
-
_, err = capture_io do
|
282
|
-
top_level = @rdoc.parse_file io.path
|
283
|
-
end
|
284
|
-
|
285
|
-
assert_match "Unable to read #{io.path},", err
|
286
|
-
|
287
|
-
assert_nil top_level
|
288
|
-
ensure
|
289
|
-
File.chmod 0400, io.path
|
290
|
-
end
|
291
|
-
io
|
292
|
-
end
|
293
|
-
tf.close! if tf.respond_to? :close!
|
294
|
-
end
|
295
|
-
|
296
|
-
def test_remove_unparseable
|
297
|
-
file_list = %w[
|
298
|
-
blah.class
|
299
|
-
blah.eps
|
300
|
-
blah.erb
|
301
|
-
blah.scpt.txt
|
302
|
-
blah.ttf
|
303
|
-
blah.yml
|
304
|
-
]
|
305
|
-
|
306
|
-
assert_empty @rdoc.remove_unparseable file_list
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_remove_unparseable_tags_emacs
|
310
|
-
temp_dir do
|
311
|
-
open 'TAGS', 'wb' do |io| # emacs
|
312
|
-
io.write "\f\nlib/foo.rb,43\n"
|
313
|
-
end
|
314
|
-
|
315
|
-
file_list = %w[
|
316
|
-
TAGS
|
317
|
-
]
|
318
|
-
|
319
|
-
assert_empty @rdoc.remove_unparseable file_list
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
def test_remove_unparseable_tags_vim
|
324
|
-
temp_dir do
|
325
|
-
open 'TAGS', 'w' do |io| # emacs
|
326
|
-
io.write "!_TAG_"
|
327
|
-
end
|
328
|
-
|
329
|
-
file_list = %w[
|
330
|
-
TAGS
|
331
|
-
]
|
332
|
-
|
333
|
-
assert_empty @rdoc.remove_unparseable file_list
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
def test_setup_output_dir
|
338
|
-
Dir.mktmpdir {|d|
|
339
|
-
path = File.join d, 'testdir'
|
340
|
-
|
341
|
-
last = @rdoc.setup_output_dir path, false
|
342
|
-
|
343
|
-
assert_empty last
|
344
|
-
|
345
|
-
assert File.directory? path
|
346
|
-
assert File.exist? @rdoc.output_flag_file path
|
347
|
-
}
|
348
|
-
end
|
349
|
-
|
350
|
-
def test_setup_output_dir_dry_run
|
351
|
-
@rdoc.options.dry_run = true
|
352
|
-
|
353
|
-
Dir.mktmpdir do |d|
|
354
|
-
path = File.join d, 'testdir'
|
355
|
-
|
356
|
-
@rdoc.setup_output_dir path, false
|
357
|
-
|
358
|
-
refute File.exist? path
|
359
|
-
end
|
360
|
-
end
|
361
|
-
|
362
|
-
def test_setup_output_dir_exists
|
363
|
-
Dir.mktmpdir {|path|
|
364
|
-
open @rdoc.output_flag_file(path), 'w' do |io|
|
365
|
-
io.puts Time.at 0
|
366
|
-
io.puts "./lib/rdoc.rb\t#{Time.at 86400}"
|
367
|
-
end
|
368
|
-
|
369
|
-
last = @rdoc.setup_output_dir path, false
|
370
|
-
|
371
|
-
assert_equal 1, last.size
|
372
|
-
assert_equal Time.at(86400), last['./lib/rdoc.rb']
|
373
|
-
}
|
374
|
-
end
|
375
|
-
|
376
|
-
def test_setup_output_dir_exists_empty_created_rid
|
377
|
-
Dir.mktmpdir {|path|
|
378
|
-
open @rdoc.output_flag_file(path), 'w' do end
|
379
|
-
|
380
|
-
e = assert_raises RDoc::Error do
|
381
|
-
@rdoc.setup_output_dir path, false
|
382
|
-
end
|
383
|
-
|
384
|
-
assert_match %r%Directory #{Regexp.escape path} already exists%, e.message
|
385
|
-
}
|
386
|
-
end
|
387
|
-
|
388
|
-
def test_setup_output_dir_exists_file
|
389
|
-
tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
|
390
|
-
path = tempfile.path
|
391
|
-
|
392
|
-
e = assert_raises RDoc::Error do
|
393
|
-
@rdoc.setup_output_dir path, false
|
394
|
-
end
|
395
|
-
|
396
|
-
assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
|
397
|
-
e.message)
|
398
|
-
tempfile
|
399
|
-
end
|
400
|
-
tf.close! if tf.respond_to? :close!
|
401
|
-
end
|
402
|
-
|
403
|
-
def test_setup_output_dir_exists_not_rdoc
|
404
|
-
Dir.mktmpdir do |dir|
|
405
|
-
e = assert_raises RDoc::Error do
|
406
|
-
@rdoc.setup_output_dir dir, false
|
407
|
-
end
|
408
|
-
|
409
|
-
assert_match %r%Directory #{Regexp.escape dir} already exists%, e.message
|
410
|
-
end
|
411
|
-
end
|
412
|
-
|
413
|
-
def test_update_output_dir
|
414
|
-
Dir.mktmpdir do |d|
|
415
|
-
@rdoc.update_output_dir d, Time.now, {}
|
416
|
-
|
417
|
-
assert File.exist? "#{d}/created.rid"
|
418
|
-
end
|
419
|
-
end
|
420
|
-
|
421
|
-
def test_update_output_dir_dont
|
422
|
-
Dir.mktmpdir do |d|
|
423
|
-
@rdoc.options.update_output_dir = false
|
424
|
-
@rdoc.update_output_dir d, Time.now, {}
|
425
|
-
|
426
|
-
refute File.exist? "#{d}/created.rid"
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
def test_update_output_dir_dry_run
|
431
|
-
Dir.mktmpdir do |d|
|
432
|
-
@rdoc.options.dry_run = true
|
433
|
-
@rdoc.update_output_dir d, Time.now, {}
|
434
|
-
|
435
|
-
refute File.exist? "#{d}/created.rid"
|
436
|
-
end
|
437
|
-
end
|
438
|
-
|
439
|
-
def test_normalized_file_list_removes_created_rid_dir
|
440
|
-
temp_dir do |d|
|
441
|
-
FileUtils.mkdir "doc"
|
442
|
-
flag_file = @rdoc.output_flag_file "doc"
|
443
|
-
file = File.join "doc", "test"
|
444
|
-
FileUtils.touch flag_file
|
445
|
-
FileUtils.touch file
|
446
|
-
|
447
|
-
file_list = ["doc"]
|
448
|
-
|
449
|
-
output = @rdoc.normalized_file_list file_list
|
450
|
-
|
451
|
-
assert_empty output
|
452
|
-
end
|
453
|
-
end
|
454
|
-
end
|
455
|
-
|