aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rdoc-2.4.3/test
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/rdoc-2.4.3/test')
-rw-r--r--vendor/gems/rdoc-2.4.3/test/binary.datbin0 -> 1024 bytes
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test.ja.rdoc8
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test.ja.txt8
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_attribute_manager.rb76
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_any_method.rb10
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_code_object.rb80
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_constant.rb15
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_context.rb250
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_include.rb17
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_markup.rb626
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_attribute_manager.rb243
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html.rb81
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html_crossref.rb161
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_normal_module.rb26
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_parser.rb29
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_c.rb401
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb74
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_ruby.rb1040
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_require.rb25
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_attribute_formatter.rb44
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_default_display.rb302
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_driver.rb94
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_formatter.rb320
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_html_formatter.rb141
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_overstrike_formatter.rb71
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_task.rb64
-rw-r--r--vendor/gems/rdoc-2.4.3/test/test_rdoc_top_level.rb85
-rw-r--r--vendor/gems/rdoc-2.4.3/test/xref_data.rb46
-rw-r--r--vendor/gems/rdoc-2.4.3/test/xref_test_case.rb48
29 files changed, 4385 insertions, 0 deletions
diff --git a/vendor/gems/rdoc-2.4.3/test/binary.dat b/vendor/gems/rdoc-2.4.3/test/binary.dat
new file mode 100644
index 000000000..371950efe
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/binary.dat
Binary files differ
diff --git a/vendor/gems/rdoc-2.4.3/test/test.ja.rdoc b/vendor/gems/rdoc-2.4.3/test/test.ja.rdoc
new file mode 100644
index 000000000..96e1db93d
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test.ja.rdoc
@@ -0,0 +1,8 @@
+こんにちは!
+
+初めまして。アーロンと申します。
+
+どんな食べ物が好きですか?私はフランスの料理が大好きです。
+日本の料理も大好きです。
+
+食べ物を食べるのが大好きだけど、お皿を洗うのが大嫌いです。
diff --git a/vendor/gems/rdoc-2.4.3/test/test.ja.txt b/vendor/gems/rdoc-2.4.3/test/test.ja.txt
new file mode 100644
index 000000000..96e1db93d
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test.ja.txt
@@ -0,0 +1,8 @@
+こんにちは!
+
+初めまして。アーロンと申します。
+
+どんな食べ物が好きですか?私はフランスの料理が大好きです。
+日本の料理も大好きです。
+
+食べ物を食べるのが大好きだけど、お皿を洗うのが大嫌いです。
diff --git a/vendor/gems/rdoc-2.4.3/test/test_attribute_manager.rb b/vendor/gems/rdoc-2.4.3/test/test_attribute_manager.rb
new file mode 100644
index 000000000..ee45c0596
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_attribute_manager.rb
@@ -0,0 +1,76 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/markup/attribute_manager'
+
+class TestAttributeManager < MiniTest::Unit::TestCase
+
+ def setup
+ @am = RDoc::Markup::AttributeManager.new
+ @klass = RDoc::Markup::AttributeManager
+ end
+
+ def teardown
+ silently do
+ @klass.const_set(:MATCHING_WORD_PAIRS, {})
+ @klass.const_set(:WORD_PAIR_MAP, {})
+ @klass.const_set(:HTML_TAGS, {})
+ end
+ end
+
+ def test_initial_word_pairs
+ word_pairs = @klass::MATCHING_WORD_PAIRS
+ assert word_pairs.is_a?(Hash)
+ assert_equal(3, word_pairs.size)
+ end
+
+ def test_initial_html
+ html_tags = @klass::HTML_TAGS
+ assert html_tags.is_a?(Hash)
+ assert_equal(5, html_tags.size)
+ end
+
+ def test_add_matching_word_pair
+ @am.add_word_pair("x","x", :TEST)
+ word_pairs = @klass::MATCHING_WORD_PAIRS
+ assert_equal(4,word_pairs.size)
+ assert(word_pairs.has_key?("x"))
+ end
+
+ def test_add_invalid_word_pair
+ assert_raises ArgumentError do
+ @am.add_word_pair("<", "<", :TEST)
+ end
+ end
+
+ def test_add_word_pair_map
+ @am.add_word_pair("x", "y", :TEST)
+ word_pair_map = @klass::WORD_PAIR_MAP
+ assert_equal(1,word_pair_map.size)
+ assert_equal(word_pair_map. keys.first.source, "(x)(\\S+)(y)")
+ end
+
+ def test_add_html_tag
+ @am.add_html("Test", :TEST)
+ tags = @klass::HTML_TAGS
+ assert_equal(6, tags.size)
+ assert(tags.has_key?("test"))
+ end
+
+ def test_add_special
+ @am.add_special("WikiWord", :WIKIWORD)
+ specials = @klass::SPECIAL
+ assert_equal(1,specials.size)
+ assert(specials.has_key?("WikiWord"))
+ end
+
+ def silently(&block)
+ warn_level = $VERBOSE
+ $VERBOSE = nil
+ result = block.call
+ $VERBOSE = warn_level
+ result
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_any_method.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_any_method.rb
new file mode 100644
index 000000000..a4e30c42b
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_any_method.rb
@@ -0,0 +1,10 @@
+require 'test/xref_test_case'
+
+class RDocAnyMethodTest < XrefTestCase
+
+ def test_full_name
+ assert_equal 'C1::m', @c1.method_list.first.full_name
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_code_object.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_code_object.rb
new file mode 100644
index 000000000..282ca1ecc
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_code_object.rb
@@ -0,0 +1,80 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'test/xref_test_case'
+require 'rdoc/code_object'
+
+class TestRDocCodeObject < XrefTestCase
+
+ def setup
+ super
+
+ @co = RDoc::CodeObject.new
+ end
+
+ def test_initialize
+ assert @co.document_self, 'document_self'
+ assert @co.document_children, 'document_children'
+ refute @co.force_documentation, 'force_documentation'
+ refute @co.done_documenting, 'done_documenting'
+ assert_equal nil, @co.comment, 'comment is nil'
+ end
+
+ def test_comment_equals
+ @co.comment = ''
+
+ assert_equal nil, @co.comment
+
+ @co.comment = 'I am a comment'
+
+ assert_equal 'I am a comment', @co.comment
+ end
+
+ def test_document_children_equals
+ @co.document_children = false
+ refute @co.document_children
+
+ @c2.document_children = false
+ assert_empty @c2.classes
+ end
+
+ def test_document_self_equals
+ @co.document_self = false
+ refute @co.document_self
+
+ @c1.document_self = false
+ assert_empty @c1.method_list
+ end
+
+ def test_parent_file_name
+ assert_equal '(unknown)', @co.parent_file_name
+ assert_equal 'xref_data.rb', @c1.parent_file_name
+ end
+
+ def test_parent_name
+ assert_equal '(unknown)', @co.parent_name
+ assert_equal 'xref_data.rb', @c1.parent_name
+ assert_equal 'C2', @c2_c3.parent_name
+ end
+
+ def test_start_doc
+ @co.document_self = false
+ @co.document_children = false
+
+ @co.start_doc
+
+ assert @co.document_self
+ assert @co.document_children
+ end
+
+ def test_stop_doc
+ @co.document_self = true
+ @co.document_children = true
+
+ @co.stop_doc
+
+ refute @co.document_self
+ refute @co.document_children
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_constant.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_constant.rb
new file mode 100644
index 000000000..9ec697224
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_constant.rb
@@ -0,0 +1,15 @@
+require 'test/xref_test_case'
+
+class TestRDocConstant < XrefTestCase
+
+ def setup
+ super
+
+ @const = @c1.constants.first
+ end
+
+ def test_path
+ assert_equal 'C1.html#CONST', @const.path
+ end
+
+end
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_context.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_context.rb
new file mode 100644
index 000000000..6360c5837
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_context.rb
@@ -0,0 +1,250 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'test/xref_test_case'
+
+class TestRDocContext < XrefTestCase
+
+ def setup
+ super
+
+ @context = RDoc::Context.new
+ end
+
+ def test_initialize
+ assert_empty @context.in_files
+ assert_equal 'unknown', @context.name
+ assert_equal '', @context.comment
+ assert_equal nil, @context.parent
+ assert_equal :public, @context.visibility
+ assert_equal 1, @context.sections.length
+
+ assert_empty @context.classes_hash
+ assert_empty @context.modules_hash
+
+ assert_empty @context.method_list
+ assert_empty @context.attributes
+ assert_empty @context.aliases
+ assert_empty @context.requires
+ assert_empty @context.includes
+ assert_empty @context.constants
+ end
+
+ def test_add_alias
+ as = RDoc::Alias.new nil, 'old_name', 'new_name', 'comment'
+
+ @context.add_alias as
+
+ assert_equal [as], @context.aliases
+ assert_equal [as], @context.unmatched_alias_lists['old_name']
+ end
+
+ def test_add_alias_method
+ meth = RDoc::AnyMethod.new nil, 'old_name'
+ as = RDoc::Alias.new nil, 'old_name', 'new_name', 'comment'
+ as.parent = @context
+
+ @context.add_method meth
+ @context.add_alias as
+
+ assert_empty @context.aliases
+ assert_empty @context.unmatched_alias_lists
+ assert_equal %w[old_name new_name], @context.method_list.map { |m| m.name }
+ end
+
+ def test_add_class
+ @c1.add_class RDoc::NormalClass, 'Klass', 'Object'
+
+ assert_includes @c1.classes.map { |k| k.full_name }, 'C1::Klass'
+ assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass'
+ end
+
+ def test_add_class_upgrade
+ @c1.add_module RDoc::NormalModule, 'Klass'
+ @c1.add_class RDoc::NormalClass, 'Klass', nil
+
+ assert_includes @c1.classes.map { |k| k.full_name }, 'C1::Klass',
+ 'c1 classes'
+ refute_includes @c1.modules.map { |k| k.full_name }, 'C1::Klass',
+ 'c1 modules'
+
+ assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass',
+ 'TopLevel classes'
+ refute_includes RDoc::TopLevel.modules.map { |k| k.full_name }, 'C1::Klass',
+ 'TopLevel modules'
+ end
+
+ def test_add_constant
+ const = RDoc::Constant.new 'NAME', 'value', 'comment'
+ @context.add_constant const
+
+ assert_equal [const], @context.constants
+ end
+
+ def test_add_include
+ incl = RDoc::Include.new 'Name', 'comment'
+ @context.add_include incl
+
+ assert_equal [incl], @context.includes
+ end
+
+ def test_add_method
+ meth = RDoc::AnyMethod.new nil, 'old_name'
+ meth.visibility = nil
+
+ @context.add_method meth
+
+ assert_equal [meth], @context.method_list
+ assert_equal :public, meth.visibility
+ end
+
+ def test_add_method_alias
+ as = RDoc::Alias.new nil, 'old_name', 'new_name', 'comment'
+ meth = RDoc::AnyMethod.new nil, 'old_name'
+
+ @context.add_alias as
+ refute_empty @context.aliases
+
+ @context.add_method meth
+
+ assert_empty @context.aliases
+ assert_empty @context.unmatched_alias_lists
+ assert_equal %w[old_name new_name], @context.method_list.map { |m| m.name }
+ end
+
+ def test_add_module
+ @c1.add_module RDoc::NormalModule, 'Mod'
+
+ assert_includes @c1.modules.map { |m| m.full_name }, 'C1::Mod'
+ end
+
+ def test_add_module_class
+ k = @c1.add_class RDoc::NormalClass, 'Klass', nil
+ m = @c1.add_module RDoc::NormalModule, 'Klass'
+
+ assert_equal k, m, 'returns class'
+ assert_empty @c1.modules
+ end
+
+ def test_add_require
+ req = RDoc::Require.new 'require', 'comment'
+ @c1.add_require req
+
+ assert_empty @c1.requires
+ assert_includes @c1.top_level.requires, req
+ end
+
+ def test_add_to
+ incl = RDoc::Include.new 'Name', 'comment'
+ arr = []
+ @context.add_to arr, incl
+
+ assert_includes arr, incl
+ assert_equal @context, incl.parent
+ assert_equal @context.current_section, incl.section
+ end
+
+ def test_add_to_no_document_self
+ incl = RDoc::Include.new 'Name', 'comment'
+ arr = []
+ @context.document_self = false
+ @context.add_to arr, incl
+
+ refute_includes arr, incl
+ end
+
+ def test_add_to_done_documenting
+ incl = RDoc::Include.new 'Name', 'comment'
+ arr = []
+ @context.done_documenting = true
+ @context.add_to arr, incl
+
+ refute_includes arr, incl
+ end
+
+ def test_classes
+ assert_equal %w[C2::C3], @c2.classes.map { |k| k.full_name }
+ assert_equal %w[C3::H1 C3::H2], @c3.classes.map { |k| k.full_name }
+ end
+
+ def test_defined_in_eh
+ assert @c1.defined_in?(@c1.top_level)
+
+ refute @c1.defined_in?(RDoc::TopLevel.new('name.rb'))
+ end
+
+ def test_equals2
+ assert_equal @c3, @c3
+ refute_equal @c2, @c3
+ refute_equal @c2_c3, @c3
+ end
+
+ def test_find_attribute_named
+ assert_equal nil, @c1.find_attribute_named('none')
+ assert_equal 'R', @c1.find_attribute_named('attr').rw
+ assert_equal 'R', @c1.find_attribute_named('attr_reader').rw
+ assert_equal 'W', @c1.find_attribute_named('attr_writer').rw
+ assert_equal 'RW', @c1.find_attribute_named('attr_accessor').rw
+ end
+
+ def test_find_constant_named
+ assert_equal nil, @c1.find_constant_named('NONE')
+ assert_equal ':const', @c1.find_constant_named('CONST').value
+ end
+
+ def test_find_enclosing_module_named
+ assert_equal nil, @c2_c3.find_enclosing_module_named('NONE')
+ assert_equal @c1, @c2_c3.find_enclosing_module_named('C1')
+ assert_equal @c2, @c2_c3.find_enclosing_module_named('C2')
+ end
+
+ def test_find_file_named
+ assert_equal nil, @c1.find_file_named('nonexistent.rb')
+ assert_equal @xref_data, @c1.find_file_named(@file_name)
+ end
+
+ def test_find_instance_method_named
+ assert_equal nil, @c1.find_instance_method_named('none')
+
+ m = @c1.find_instance_method_named('m')
+ assert_instance_of RDoc::AnyMethod, m
+ assert_equal false, m.singleton
+ end
+
+ def test_find_local_symbol
+ assert_equal true, @c1.find_local_symbol('m').singleton
+ assert_equal ':const', @c1.find_local_symbol('CONST').value
+ assert_equal 'R', @c1.find_local_symbol('attr').rw
+ assert_equal @xref_data, @c1.find_local_symbol(@file_name)
+ assert_equal @c2_c3, @c2.find_local_symbol('C3')
+ end
+
+ def test_find_method_named
+ assert_equal true, @c1.find_method_named('m').singleton
+ end
+
+ def test_find_module_named
+ assert_equal @c2_c3, @c2.find_module_named('C3')
+ assert_equal @c2, @c2.find_module_named('C2')
+ assert_equal @c1, @c2.find_module_named('C1')
+
+ assert_equal 'C2::C3', @c2.find_module_named('C3').full_name
+ end
+
+ def test_find_symbol
+ c3 = @xref_data.find_module_named('C3')
+ assert_equal c3, @xref_data.find_symbol('C3')
+ assert_equal c3, @c2.find_symbol('::C3')
+ assert_equal @c2_c3, @c2.find_symbol('C3')
+ end
+
+ def test_spaceship
+ assert_equal(-1, @c2.<=>(@c3))
+ assert_equal 0, @c2.<=>(@c2)
+ assert_equal 1, @c3.<=>(@c2)
+
+ assert_equal 1, @c2_c3.<=>(@c2)
+ assert_equal(-1, @c2_c3.<=>(@c3))
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_include.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_include.rb
new file mode 100644
index 000000000..6e305dd13
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_include.rb
@@ -0,0 +1,17 @@
+require 'test/xref_test_case'
+
+class TestRDocInclude < XrefTestCase
+
+ def setup
+ super
+
+ @inc = RDoc::Include.new 'M1', 'comment'
+ end
+
+ def test_module
+ assert_equal @m1, @inc.module
+ assert_equal 'Unknown', RDoc::Include.new('Unknown', 'comment').module
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup.rb
new file mode 100644
index 000000000..ce962a2c5
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup.rb
@@ -0,0 +1,626 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/markup'
+require 'rdoc/markup/to_test'
+
+class TestRDocMarkup < MiniTest::Unit::TestCase
+
+ def basic_conv(str)
+ sm = RDoc::Markup.new
+ mock = RDoc::Markup::ToTest.new
+ sm.convert(str, mock)
+ sm.content
+ end
+
+ def line_groups(str, expected)
+ m = RDoc::Markup.new
+ mock = RDoc::Markup::ToTest.new
+
+ block = m.convert(str, mock)
+
+ unless block == expected then
+ rows = (0...([expected.size, block.size].max)).collect{|i|
+ [expected[i]||"nil", block[i]||"nil"]
+ }
+ printf "\n\n%35s %35s\n", "Expected", "Got"
+ rows.each { |e,g| printf "%35s %35s\n", e.dump, g.dump }
+ end
+
+ assert_equal(expected, block)
+ end
+
+ def line_types(str, expected)
+ m = RDoc::Markup.new
+ mock = RDoc::Markup::ToTest.new
+ m.convert(str, mock)
+ assert_equal(expected, m.get_line_types.map{|type| type.to_s[0,1]}.join(''))
+ end
+
+ def test_groups
+ str = "now is the time"
+ line_groups(str, ["L0: Paragraph\nnow is the time"] )
+
+ str = "now is the time\nfor all good men"
+ line_groups(str, ["L0: Paragraph\nnow is the time for all good men"] )
+
+ str = %{\
+ now is the time
+ code _line_ here
+ for all good men}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is the time",
+ "L0: Verbatim\n code _line_ here\n",
+ "L0: Paragraph\nfor all good men"
+ ] )
+
+ str = "now is the time\n code\n more code\nfor all good men"
+ line_groups(str,
+ [ "L0: Paragraph\nnow is the time",
+ "L0: Verbatim\n code\n more code\n",
+ "L0: Paragraph\nfor all good men"
+ ] )
+
+ str = %{\
+ now is
+ * l1
+ * l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl1",
+ "L1: BULLET ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+ str = %{\
+ now is
+ * l1
+ l1+
+ * l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl1 l1+",
+ "L1: BULLET ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+ str = %{\
+ now is
+ * l1
+ * l1.1
+ * l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl1",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\nl1.1",
+ "L2: ListEnd\n",
+ "L1: BULLET ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ * l1
+ * l1.1
+ text
+ code
+ code
+
+ text
+ * l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl1",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\nl1.1 text",
+ "L2: Verbatim\n code\n code\n",
+ "L2: Paragraph\ntext",
+ "L2: ListEnd\n",
+ "L1: BULLET ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ 1. l1
+ * l1.1
+ 2. l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: NUMBER ListItem\nl1",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\nl1.1",
+ "L2: ListEnd\n",
+ "L1: NUMBER ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+ str = %{\
+ now is
+ [cat] l1
+ * l1.1
+ [dog] l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: LABELED ListItem\ncat: l1",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\nl1.1",
+ "L2: ListEnd\n",
+ "L1: LABELED ListItem\ndog: l2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+ str = %{\
+ now is
+ [cat] l1
+ continuation
+ [dog] l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: LABELED ListItem\ncat: l1 continuation",
+ "L1: LABELED ListItem\ndog: l2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+ end
+
+ def test_headings
+ str = "= heading one"
+ line_groups(str,
+ [ "L0: Heading\nheading one"
+ ])
+
+ str = "=== heading three"
+ line_groups(str,
+ [ "L0: Heading\nheading three"
+ ])
+
+ str = "text\n === heading three"
+ line_groups(str,
+ [ "L0: Paragraph\ntext",
+ "L0: Verbatim\n === heading three\n"
+ ])
+
+ str = "text\n code\n === heading three"
+ line_groups(str,
+ [ "L0: Paragraph\ntext",
+ "L0: Verbatim\n code\n === heading three\n"
+ ])
+
+ str = "text\n code\n=== heading three"
+ line_groups(str,
+ [ "L0: Paragraph\ntext",
+ "L0: Verbatim\n code\n",
+ "L0: Heading\nheading three"
+ ])
+
+ end
+
+ def test_list_alpha
+ str = "a. alpha\nb. baker\nB. ALPHA\nA. BAKER"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: LOWERALPHA ListItem\nalpha",
+ "L1: LOWERALPHA ListItem\nbaker",
+ "L1: ListEnd\n",
+ "L1: ListStart\n",
+ "L1: UPPERALPHA ListItem\nALPHA",
+ "L1: UPPERALPHA ListItem\nBAKER",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_bullet_dash
+ str = "- one\n- two\n"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: BULLET ListItem\none",
+ "L1: BULLET ListItem\ntwo",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_bullet_star
+ str = "* one\n* two\n"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: BULLET ListItem\none",
+ "L1: BULLET ListItem\ntwo",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_labeled_bracket
+ str = "[one] item one\n[two] item two"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: LABELED ListItem\none: item one",
+ "L1: LABELED ListItem\ntwo: item two",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_labeled_bracket_continued
+ str = "[one]\n item one\n[two]\n item two"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: LABELED ListItem\none: item one",
+ "L1: LABELED ListItem\ntwo: item two",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_labeled_colon
+ str = "one:: item one\ntwo:: item two"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: NOTE ListItem\none:: item one",
+ "L1: NOTE ListItem\ntwo:: item two",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_labeled_colon_continued
+ str = "one::\n item one\ntwo::\n item two"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: NOTE ListItem\none:: item one",
+ "L1: NOTE ListItem\ntwo:: item two",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_nested_bullet_bullet
+ str = "* one\n* two\n * cat\n * dog"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: BULLET ListItem\none",
+ "L1: BULLET ListItem\ntwo",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\ncat",
+ "L2: BULLET ListItem\ndog",
+ "L2: ListEnd\n",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_nested_labeled_bullet
+ str = "[one]\n * cat\n * dog"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: LABELED ListItem\none: ",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\ncat",
+ "L2: BULLET ListItem\ndog",
+ "L2: ListEnd\n",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_nested_labeled_bullet_bullet
+ str = "[one]\n * cat\n * dog"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: LABELED ListItem\none: ",
+ "L2: ListStart\n",
+ "L2: BULLET ListItem\ncat",
+ "L3: ListStart\n",
+ "L3: BULLET ListItem\ndog",
+ "L3: ListEnd\n",
+ "L2: ListEnd\n",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_nested_number_number
+ str = "1. one\n1. two\n 1. cat\n 1. dog"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: NUMBER ListItem\none",
+ "L1: NUMBER ListItem\ntwo",
+ "L2: ListStart\n",
+ "L2: NUMBER ListItem\ncat",
+ "L2: NUMBER ListItem\ndog",
+ "L2: ListEnd\n",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_number
+ str = "1. one\n2. two\n1. three"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: NUMBER ListItem\none",
+ "L1: NUMBER ListItem\ntwo",
+ "L1: NUMBER ListItem\nthree",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_list_split
+ str = %{\
+ now is
+ * l1
+ 1. n1
+ 2. n2
+ * l2
+ the time}
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl1",
+ "L1: ListEnd\n",
+ "L1: ListStart\n",
+ "L1: NUMBER ListItem\nn1",
+ "L1: NUMBER ListItem\nn2",
+ "L1: ListEnd\n",
+ "L1: ListStart\n",
+ "L1: BULLET ListItem\nl2",
+ "L1: ListEnd\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+ end
+
+ def test_list_verbatim
+ str = "* one\n verb1\n verb2\n* two\n"
+
+ line_groups(str,
+ [ "L1: ListStart\n",
+ "L1: BULLET ListItem\none",
+ "L1: Verbatim\n verb1\n verb2\n",
+ "L1: BULLET ListItem\ntwo",
+ "L1: ListEnd\n" ])
+ end
+
+ def test_paragraph
+ str = "paragraph\n\n*bold* paragraph\n"
+
+ line_groups str, [
+ "L0: Paragraph\nparagraph",
+ "L0: BlankLine\n",
+ "L0: Paragraph\n*bold* paragraph"
+ ]
+ end
+
+ def test_tabs
+ str = "hello\n dave"
+ assert_equal(str, basic_conv(str))
+ str = "hello\n\tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = "hello\n \tdave"
+ assert_equal("hello\n dave", basic_conv(str))
+ str = ".\t\t."
+ assert_equal(". .", basic_conv(str))
+ end
+
+ def test_types
+ str = "now is the time"
+ line_types(str, 'P')
+
+ str = "now is the time\nfor all good men"
+ line_types(str, 'PP')
+
+ str = "now is the time\n code\nfor all good men"
+ line_types(str, 'PVP')
+
+ str = "now is the time\n code\n more code\nfor all good men"
+ line_types(str, 'PVVP')
+
+ str = "now is\n---\nthe time"
+ line_types(str, 'PRP')
+
+ str = %{\
+ now is
+ * l1
+ * l2
+ the time}
+ line_types(str, 'PLLP')
+
+ str = %{\
+ now is
+ * l1
+ l1+
+ * l2
+ the time}
+ line_types(str, 'PLPLP')
+
+ str = %{\
+ now is
+ * l1
+ * l1.1
+ * l2
+ the time}
+ line_types(str, 'PLLLP')
+
+ str = %{\
+ now is
+ * l1
+ * l1.1
+ text
+ code
+ code
+
+ text
+ * l2
+ the time}
+ line_types(str, 'PLLPVVBPLP')
+
+ str = %{\
+ now is
+ 1. l1
+ * l1.1
+ 2. l2
+ the time}
+ line_types(str, 'PLLLP')
+
+ str = %{\
+ now is
+ [cat] l1
+ * l1.1
+ [dog] l2
+ the time}
+ line_types(str, 'PLLLP')
+
+ str = %{\
+ now is
+ [cat] l1
+ continuation
+ [dog] l2
+ the time}
+ line_types(str, 'PLPLP')
+ end
+
+ def test_verbatim
+ str = "paragraph\n *bold* verbatim\n"
+
+ line_groups str, [
+ "L0: Paragraph\nparagraph",
+ "L0: Verbatim\n *bold* verbatim\n"
+ ]
+ end
+
+ def test_verbatim_merge
+ str = %{\
+ now is
+ code
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ code
+ code1
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n code1\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ code
+
+ code1
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n\n code1\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ code
+
+ code1
+
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n\n code1\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ str = %{\
+ now is
+ code
+
+ code1
+
+ code2
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n\n code1\n\n code2\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ # Folds multiple blank lines
+ str = %{\
+ now is
+ code
+
+
+ code1
+
+ the time}
+
+ line_groups(str,
+ [ "L0: Paragraph\nnow is",
+ "L0: Verbatim\n code\n\n code1\n",
+ "L0: Paragraph\nthe time"
+ ])
+
+
+ end
+
+ def test_whitespace
+ assert_equal("hello", basic_conv("hello"))
+ assert_equal("hello", basic_conv(" hello "))
+ assert_equal("hello", basic_conv(" \t \t hello\t\t"))
+
+ assert_equal("1\n 2\n 3", basic_conv("1\n 2\n 3"))
+ assert_equal("1\n 2\n 3", basic_conv(" 1\n 2\n 3"))
+
+ assert_equal("1\n 2\n 3\n1\n 2", basic_conv("1\n 2\n 3\n1\n 2"))
+ assert_equal("1\n 2\n 3\n1\n 2", basic_conv(" 1\n 2\n 3\n 1\n 2"))
+
+ assert_equal("1\n 2\n\n 3", basic_conv(" 1\n 2\n\n 3"))
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_attribute_manager.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_attribute_manager.rb
new file mode 100644
index 000000000..0864523a0
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_attribute_manager.rb
@@ -0,0 +1,243 @@
+require "rubygems"
+require "minitest/unit"
+require "rdoc/markup/inline"
+require "rdoc/markup/to_html_crossref"
+
+class TestRDocMarkupAttributeManager < MiniTest::Unit::TestCase
+
+ def setup
+ @orig_special = RDoc::Markup::AttributeManager::SPECIAL
+ RDoc::Markup::AttributeManager::SPECIAL.replace Hash.new
+
+ @am = RDoc::Markup::AttributeManager.new
+
+ @bold_on = @am.changed_attribute_by_name([], [:BOLD])
+ @bold_off = @am.changed_attribute_by_name([:BOLD], [])
+
+ @tt_on = @am.changed_attribute_by_name([], [:TT])
+ @tt_off = @am.changed_attribute_by_name([:TT], [])
+
+ @em_on = @am.changed_attribute_by_name([], [:EM])
+ @em_off = @am.changed_attribute_by_name([:EM], [])
+
+ @bold_em_on = @am.changed_attribute_by_name([], [:BOLD] | [:EM])
+ @bold_em_off = @am.changed_attribute_by_name([:BOLD] | [:EM], [])
+
+ @em_then_bold = @am.changed_attribute_by_name([:EM], [:EM] | [:BOLD])
+
+ @em_to_bold = @am.changed_attribute_by_name([:EM], [:BOLD])
+
+ @am.add_word_pair("{", "}", :WOMBAT)
+ @wombat_on = @am.changed_attribute_by_name([], [:WOMBAT])
+ @wombat_off = @am.changed_attribute_by_name([:WOMBAT], [])
+ end
+
+ def teardown
+ RDoc::Markup::AttributeManager::SPECIAL.replace @orig_special
+ end
+
+ def crossref(text)
+ crossref_bitmap = RDoc::Markup::Attribute.bitmap_for(:_SPECIAL_) |
+ RDoc::Markup::Attribute.bitmap_for(:CROSSREF)
+
+ [ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]),
+ RDoc::Markup::Special.new(crossref_bitmap, text),
+ @am.changed_attribute_by_name([:CROSSREF, :_SPECIAL_], [])
+ ]
+ end
+
+ def test_adding
+ assert_equal(["cat ", @wombat_on, "and", @wombat_off, " dog" ],
+ @am.flow("cat {and} dog"))
+ #assert_equal(["cat {and} dog" ], @am.flow("cat \\{and} dog"))
+ end
+
+ def test_add_word_pair
+ @am.add_word_pair '%', '&', 'percent and'
+
+ assert RDoc::Markup::AttributeManager::WORD_PAIR_MAP.include?(/(%)(\S+)(&)/)
+ assert RDoc::Markup::AttributeManager::PROTECTABLE.include?('%')
+ assert !RDoc::Markup::AttributeManager::PROTECTABLE.include?('&')
+ end
+
+ def test_add_word_pair_angle
+ e = assert_raises ArgumentError do
+ @am.add_word_pair '<', '>', 'angles'
+ end
+
+ assert_equal "Word flags may not start with '<'", e.message
+ end
+
+ def test_add_word_pair_matching
+ @am.add_word_pair '^', '^', 'caret'
+
+ assert RDoc::Markup::AttributeManager::MATCHING_WORD_PAIRS.include?('^')
+ assert RDoc::Markup::AttributeManager::PROTECTABLE.include?('^')
+ end
+
+ def test_basic
+ assert_equal(["cat"], @am.flow("cat"))
+
+ assert_equal(["cat ", @bold_on, "and", @bold_off, " dog"],
+ @am.flow("cat *and* dog"))
+
+ assert_equal(["cat ", @bold_on, "AND", @bold_off, " dog"],
+ @am.flow("cat *AND* dog"))
+
+ assert_equal(["cat ", @em_on, "And", @em_off, " dog"],
+ @am.flow("cat _And_ dog"))
+
+ assert_equal(["cat *and dog*"], @am.flow("cat *and dog*"))
+
+ assert_equal(["*cat and* dog"], @am.flow("*cat and* dog"))
+
+ assert_equal(["cat *and ", @bold_on, "dog", @bold_off],
+ @am.flow("cat *and *dog*"))
+
+ assert_equal(["cat ", @em_on, "and", @em_off, " dog"],
+ @am.flow("cat _and_ dog"))
+
+ assert_equal(["cat_and_dog"],
+ @am.flow("cat_and_dog"))
+
+ assert_equal(["cat ", @tt_on, "and", @tt_off, " dog"],
+ @am.flow("cat +and+ dog"))
+
+ assert_equal(["cat ", @bold_on, "a_b_c", @bold_off, " dog"],
+ @am.flow("cat *a_b_c* dog"))
+
+ assert_equal(["cat __ dog"],
+ @am.flow("cat __ dog"))
+
+ assert_equal(["cat ", @em_on, "_", @em_off, " dog"],
+ @am.flow("cat ___ dog"))
+ end
+
+ def test_bold
+ assert_equal [@bold_on, 'bold', @bold_off],
+ @am.flow("*bold*")
+
+ assert_equal [@bold_on, 'Bold:', @bold_off],
+ @am.flow("*Bold:*")
+
+ assert_equal [@bold_on, '\\bold', @bold_off],
+ @am.flow("*\\bold*")
+ end
+
+ def test_bold_html_escaped
+ assert_equal ['cat <b>dog</b>'], @am.flow('cat \<b>dog</b>')
+ end
+
+ def test_combined
+ assert_equal(["cat ", @em_on, "and", @em_off, " ", @bold_on, "dog", @bold_off],
+ @am.flow("cat _and_ *dog*"))
+
+ assert_equal(["cat ", @em_on, "a__nd", @em_off, " ", @bold_on, "dog", @bold_off],
+ @am.flow("cat _a__nd_ *dog*"))
+ end
+
+ def test_convert_attrs
+ str = '+foo+'
+ attrs = RDoc::Markup::AttrSpan.new str.length
+
+ @am.convert_attrs str, attrs
+
+ assert_equal "\000foo\000", str
+
+ str = '+:foo:+'
+ attrs = RDoc::Markup::AttrSpan.new str.length
+
+ @am.convert_attrs str, attrs
+
+ assert_equal "\000:foo:\000", str
+
+ str = '+x-y+'
+ attrs = RDoc::Markup::AttrSpan.new str.length
+
+ @am.convert_attrs str, attrs
+
+ assert_equal "\000x-y\000", str
+ end
+
+ def test_html_like_em_bold
+ assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
+ @am.flow("cat <i>and </i><b>dog</b>")
+ end
+
+ def test_html_like_em_bold_SGML
+ assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
+ @am.flow("cat <i>and <b></i>dog</b>")
+ end
+
+ def test_html_like_em_bold_nested_1
+ assert_equal(["cat ", @bold_em_on, "and", @bold_em_off, " dog"],
+ @am.flow("cat <i><b>and</b></i> dog"))
+ end
+
+ def test_html_like_em_bold_nested_2
+ assert_equal ["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
+ @am.flow("cat <i>and <b>dog</b></i>")
+ end
+
+ def test_html_like_em_bold_nested_mixed_case
+ assert_equal ["cat ", @em_on, "and ", @em_then_bold, "dog", @bold_em_off],
+ @am.flow("cat <i>and <B>dog</B></I>")
+ end
+
+ def test_html_like_em_bold_mixed_case
+ assert_equal ["cat ", @em_on, "and", @em_off, " ", @bold_on, "dog", @bold_off],
+ @am.flow("cat <i>and</i> <B>dog</b>")
+ end
+
+ def test_html_like_teletype
+ assert_equal ["cat ", @tt_on, "dog", @tt_off],
+ @am.flow("cat <tt>dog</Tt>")
+ end
+
+ def test_html_like_teletype_em_bold_SGML
+ assert_equal [@tt_on, "cat", @tt_off, " ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
+ @am.flow("<tt>cat</tt> <i>and <b></i>dog</b>")
+ end
+
+ def test_protect
+ assert_equal(['cat \\ dog'], @am.flow('cat \\ dog'))
+
+ assert_equal(["cat <tt>dog</Tt>"], @am.flow("cat \\<tt>dog</Tt>"))
+
+ assert_equal(["cat ", @em_on, "and", @em_off, " <B>dog</b>"],
+ @am.flow("cat <i>and</i> \\<B>dog</b>"))
+
+ assert_equal(["*word* or <b>text</b>"], @am.flow("\\*word* or \\<b>text</b>"))
+
+ assert_equal(["_cat_", @em_on, "dog", @em_off],
+ @am.flow("\\_cat_<i>dog</i>"))
+ end
+
+ def test_special
+ @am.add_special(RDoc::Markup::ToHtmlCrossref::CROSSREF_REGEXP, :CROSSREF)
+
+ #
+ # The apostrophes in "cats'" and "dogs'" suppress the flagging of these
+ # words as potential cross-references, which is necessary for the unit
+ # tests. Unfortunately, the markup engine right now does not actually
+ # check whether a cross-reference is valid before flagging it.
+ #
+ assert_equal(["cats'"], @am.flow("cats'"))
+
+ assert_equal(["cats' ", crossref("#fred"), " dogs'"].flatten,
+ @am.flow("cats' #fred dogs'"))
+
+ assert_equal([crossref("#fred"), " dogs'"].flatten,
+ @am.flow("#fred dogs'"))
+
+ assert_equal(["cats' ", crossref("#fred")].flatten, @am.flow("cats' #fred"))
+ end
+
+ def test_tt_html
+ assert_equal [@tt_on, '"\n"', @tt_off],
+ @am.flow('<tt>"\n"</tt>')
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html.rb
new file mode 100644
index 000000000..5b8c09ccf
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html.rb
@@ -0,0 +1,81 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/markup'
+require 'rdoc/markup/to_html'
+
+class TestRDocMarkupToHtml < MiniTest::Unit::TestCase
+
+ def setup
+ @m = RDoc::Markup.new
+ @am = RDoc::Markup::AttributeManager.new
+ @th = RDoc::Markup::ToHtml.new
+ end
+
+ def test_class_gen_relative_url
+ def gen(from, to)
+ RDoc::Markup::ToHtml.gen_relative_url from, to
+ end
+
+ assert_equal 'a.html', gen('a.html', 'a.html')
+ assert_equal 'b.html', gen('a.html', 'b.html')
+
+ assert_equal 'd.html', gen('a/c.html', 'a/d.html')
+ assert_equal '../a.html', gen('a/c.html', 'a.html')
+ assert_equal 'a/c.html', gen('a.html', 'a/c.html')
+ end
+
+ def test_list_verbatim
+ str = "* one\n verb1\n verb2\n* two\n"
+
+ expected = <<-EXPECTED
+<ul>
+<li>one
+
+<pre>
+ verb1
+ verb2
+</pre>
+</li>
+<li>two
+
+</li>
+</ul>
+ EXPECTED
+
+ assert_equal expected, @m.convert(str, @th)
+ end
+
+ def test_tt_formatting
+ assert_equal "<p>\n<tt>--</tt> &#8212; <tt>cats'</tt> cats&#8217;\n</p>\n",
+ util_format("<tt>--</tt> -- <tt>cats'</tt> cats'")
+
+ assert_equal "<p>\n<b>&#8212;</b>\n</p>\n", util_format("<b>--</b>")
+ end
+
+ def test_convert_string_fancy
+ #
+ # The HTML typesetting is broken in a number of ways, but I have fixed
+ # the most glaring issues for single and double quotes. Note that
+ # "strange" symbols (periods or dashes) need to be at the end of the
+ # test case strings in order to suppress cross-references.
+ #
+ assert_equal "<p>\n&#8220;cats&#8221;.\n</p>\n", util_format("\"cats\".")
+ assert_equal "<p>\n&#8216;cats&#8217;.\n</p>\n", util_format("\'cats\'.")
+ assert_equal "<p>\ncat&#8217;s-\n</p>\n", util_format("cat\'s-")
+ end
+
+ def util_fragment(text)
+ RDoc::Markup::Fragment.new 0, nil, nil, text
+ end
+
+ def util_format(text)
+ fragment = util_fragment text
+
+ @th.start_accepting
+ @th.accept_paragraph @am, fragment
+ @th.end_accepting
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html_crossref.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html_crossref.rb
new file mode 100644
index 000000000..9e77c4bdc
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_markup_to_html_crossref.rb
@@ -0,0 +1,161 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/rdoc'
+require 'rdoc/code_objects'
+require 'rdoc/markup/to_html_crossref'
+require 'test/xref_test_case'
+
+class TestRDocMarkupToHtmlCrossref < XrefTestCase
+
+ def setup
+ super
+
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'index.html', @c1, true
+ end
+
+ def assert_ref(path, ref)
+ assert_equal "<p>\n<a href=\"#{path}\">#{ref}</a>\n</p>\n",
+ @xref.convert(ref)
+ end
+
+ def refute_ref(body, ref)
+ assert_equal "<p>\n#{body}\n</p>\n", @xref.convert(ref)
+ end
+
+ def test_handle_special_CROSSREF_C2
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2.html', @c2, true
+
+ refute_ref '#m', '#m'
+
+ assert_ref '../C2/C3.html', 'C2::C3'
+ assert_ref '../C2/C3.html#M000002', 'C2::C3#m'
+ assert_ref '../C2/C3/H1.html', 'C3::H1'
+ assert_ref '../C4.html', 'C4'
+
+ # TODO there is a C3::H2 in the top-level namespace and RDoc should follow
+ # constant scoping rules
+ refute_ref 'C3::H2', 'C3::H2'
+ refute_ref 'H1', 'H1'
+ end
+
+ def test_handle_special_CROSSREF_C2_C3
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C2/C3.html', @c2_c3, true
+
+ assert_ref '../../C2/C3.html#M000002', '#m'
+
+ assert_ref '../../C2/C3.html', 'C3'
+ assert_ref '../../C2/C3.html#M000002', 'C3#m'
+
+ assert_ref '../../C2/C3/H1.html', 'H1'
+ assert_ref '../../C2/C3/H1.html', 'C3::H1'
+
+ assert_ref '../../C4.html', 'C4'
+
+ refute_ref 'C3::H2', 'C3::H2'
+ end
+
+ def test_handle_special_CROSSREF_C3
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C3.html', @c3, true
+
+ assert_ref '../C3.html', 'C3'
+
+ refute_ref '#m', '#m'
+ refute_ref 'C3#m', 'C3#m'
+
+ assert_ref '../C3/H1.html', 'H1'
+
+ assert_ref '../C3/H1.html', 'C3::H1'
+ assert_ref '../C3/H2.html', 'C3::H2'
+
+ assert_ref '../C4.html', 'C4'
+ end
+
+ def test_handle_special_CROSSREF_C4
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4.html', @c4, true
+
+ # C4 ref inside a C4 containing a C4 should resolve to the contained class
+ assert_ref '../C4/C4.html', 'C4'
+ end
+
+ def test_handle_special_CROSSREF_C4_C4
+ @xref = RDoc::Markup::ToHtmlCrossref.new 'classes/C4/C4.html', @c4_c4, true
+
+ # A C4 reference inside a C4 class contained within a C4 class should
+ # resolve to the inner C4 class.
+ assert_ref '../../C4/C4.html', 'C4'
+ end
+
+ def test_handle_special_CROSSREF_class
+ assert_ref 'C1.html', 'C1'
+ refute_ref 'H1', 'H1'
+
+ assert_ref 'C2.html', 'C2'
+ assert_ref 'C2/C3.html', 'C2::C3'
+ assert_ref 'C2/C3/H1.html', 'C2::C3::H1'
+
+ assert_ref 'C3.html', '::C3'
+ assert_ref 'C3/H1.html', '::C3::H1'
+
+ assert_ref 'C4/C4.html', 'C4::C4'
+ end
+
+ def test_handle_special_CROSSREF_file
+ assert_ref 'xref_data_rb.html', 'xref_data.rb'
+ end
+
+ def test_handle_special_CROSSREF_method
+ refute_ref 'm', 'm'
+ assert_ref 'C1.html#M000000', '#m'
+
+ assert_ref 'C1.html#M000000', 'C1#m'
+ assert_ref 'C1.html#M000000', 'C1#m()'
+ assert_ref 'C1.html#M000000', 'C1#m(*)'
+
+ assert_ref 'C1.html#M000000', 'C1.m'
+ assert_ref 'C1.html#M000000', 'C1.m()'
+ assert_ref 'C1.html#M000000', 'C1.m(*)'
+
+ # HACK should this work
+ #assert_ref 'classes/C1.html#M000001', 'C1::m'
+ #assert_ref 'classes/C1.html#M000001', 'C1::m()'
+ #assert_ref 'classes/C1.html#M000001', 'C1::m(*)'
+
+ assert_ref 'C2/C3.html#M000002', 'C2::C3#m'
+
+ assert_ref 'C2/C3.html#M000002', 'C2::C3.m'
+
+ assert_ref 'C2/C3/H1.html#M000003', 'C2::C3::H1#m?'
+
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m'
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m()'
+ assert_ref 'C2/C3.html#M000002', '::C2::C3#m(*)'
+ end
+
+ def test_handle_special_CROSSREF_no_ref
+ assert_equal '', @xref.convert('')
+
+ refute_ref 'bogus', 'bogus'
+ refute_ref 'bogus', '\bogus'
+ refute_ref '\bogus', '\\\bogus'
+
+ refute_ref '#n', '\#n'
+ refute_ref '#n()', '\#n()'
+ refute_ref '#n(*)', '\#n(*)'
+
+ refute_ref 'C1', '\C1'
+ refute_ref '::C3', '\::C3'
+
+ refute_ref '::C3::H1#n', '::C3::H1#n'
+ refute_ref '::C3::H1#n(*)', '::C3::H1#n(*)'
+ refute_ref '::C3::H1#n', '\::C3::H1#n'
+ end
+
+ def test_handle_special_CROSSREF_special
+ assert_equal "<p>\n<a href=\"C2/C3.html\">C2::C3</a>;method(*)\n</p>\n",
+ @xref.convert('C2::C3;method(*)')
+ end
+
+end
+
+MiniTest::Unit.autorun
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_normal_module.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_normal_module.rb
new file mode 100644
index 000000000..9bd681954
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_normal_module.rb
@@ -0,0 +1,26 @@
+require 'test/xref_test_case'
+
+class TestRDocNormalModule < XrefTestCase
+
+ def setup
+ super
+
+ @mod = RDoc::NormalModule.new 'Mod'
+ end
+
+ def test_comment_equals
+ @mod.comment = '# comment 1'
+
+ assert_equal '# comment 1', @mod.comment
+
+ @mod.comment = '# comment 2'
+
+ assert_equal "# comment 1\n# ---\n# comment 2", @mod.comment
+ end
+
+ def test_module_eh
+ assert @mod.module?
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser.rb
new file mode 100644
index 000000000..ae4801c42
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser.rb
@@ -0,0 +1,29 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/parser'
+require 'rdoc/parser/ruby'
+
+class TestRDocParser < MiniTest::Unit::TestCase
+ def test_can_parse
+ assert_equal(RDoc::Parser.can_parse(__FILE__), RDoc::Parser::Ruby)
+
+ readme_file_name = File.join(File.dirname(__FILE__), "..", "README.txt")
+
+ unless File.exist? readme_file_name then # HACK for tests in trunk :/
+ readme_file_name = File.join File.dirname(__FILE__), '..', '..', 'README'
+ end
+
+ assert_equal(RDoc::Parser.can_parse(readme_file_name), RDoc::Parser::Simple)
+
+ binary_file_name = File.join(File.dirname(__FILE__), "binary.dat")
+ assert_equal(RDoc::Parser.can_parse(binary_file_name), nil)
+
+ jtest_file_name = File.join(File.dirname(__FILE__), "test.ja.txt")
+ assert_equal(RDoc::Parser::Simple, RDoc::Parser.can_parse(jtest_file_name))
+
+ jtest_rdoc_file_name = File.join(File.dirname(__FILE__), "test.ja.rdoc")
+ assert_equal(RDoc::Parser::Simple, RDoc::Parser.can_parse(jtest_rdoc_file_name))
+ end
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_c.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_c.rb
new file mode 100644
index 000000000..6d129cebe
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_c.rb
@@ -0,0 +1,401 @@
+require 'stringio'
+require 'tempfile'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/options'
+require 'rdoc/parser/c'
+
+class RDoc::Parser::C
+ attr_accessor :classes
+
+ public :do_classes, :do_constants
+end
+
+class TestRDocParserC < MiniTest::Unit::TestCase
+
+ def setup
+ @tempfile = Tempfile.new self.class.name
+ filename = @tempfile.path
+
+ @top_level = RDoc::TopLevel.new filename
+ @fn = filename
+ @options = RDoc::Options.new
+ @stats = RDoc::Stats.new 0
+
+ RDoc::Parser::C.reset
+ RDoc::TopLevel.reset
+ end
+
+ def teardown
+ @tempfile.close
+ end
+
+ def test_do_classes_boot_class
+ content = <<-EOF
+/* Document-class: Foo
+ * this is the Foo boot class
+ */
+VALUE cFoo = boot_defclass("Foo", 0);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal " this is the Foo boot class\n ", klass.comment
+ end
+
+ def test_do_classes_class
+ content = <<-EOF
+/* Document-class: Foo
+ * this is the Foo class
+ */
+VALUE cFoo = rb_define_class("Foo", rb_cObject);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal " this is the Foo class\n ", klass.comment
+ end
+
+ def test_do_classes_class_under
+ content = <<-EOF
+/* Document-class: Kernel::Foo
+ * this is the Foo class under Kernel
+ */
+VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal " this is the Foo class under Kernel\n ", klass.comment
+ end
+
+ def test_do_classes_module
+ content = <<-EOF
+/* Document-module: Foo
+ * this is the Foo module
+ */
+VALUE mFoo = rb_define_module("Foo");
+ EOF
+
+ klass = util_get_class content, 'mFoo'
+ assert_equal " this is the Foo module\n ", klass.comment
+ end
+
+ def test_do_classes_module_under
+ content = <<-EOF
+/* Document-module: Kernel::Foo
+ * this is the Foo module under Kernel
+ */
+VALUE mFoo = rb_define_module_under(rb_mKernel, "Foo");
+ EOF
+
+ klass = util_get_class content, 'mFoo'
+ assert_equal " this is the Foo module under Kernel\n ", klass.comment
+ end
+
+ def test_do_constants
+ content = <<-EOF
+#include <ruby.h>
+
+void Init_foo(){
+ VALUE cFoo = rb_define_class("Foo", rb_cObject);
+
+ /* 300: The highest possible score in bowling */
+ rb_define_const(cFoo, "PERFECT", INT2FIX(300));
+
+ /* Huzzah!: What you cheer when you roll a perfect game */
+ rb_define_const(cFoo, "CHEER", rb_str_new2("Huzzah!"));
+
+ /* TEST\:TEST: Checking to see if escaped semicolon works */
+ rb_define_const(cFoo, "TEST", rb_str_new2("TEST:TEST"));
+
+ /* \\: The file separator on MS Windows */
+ rb_define_const(cFoo, "MSEPARATOR", rb_str_new2("\\"));
+
+ /* /: The file separator on Unix */
+ rb_define_const(cFoo, "SEPARATOR", rb_str_new2("/"));
+
+ /* C:\\Program Files\\Stuff: A directory on MS Windows */
+ rb_define_const(cFoo, "STUFF", rb_str_new2("C:\\Program Files\\Stuff"));
+
+ /* Default definition */
+ rb_define_const(cFoo, "NOSEMI", INT2FIX(99));
+
+ rb_define_const(cFoo, "NOCOMMENT", rb_str_new2("No comment"));
+
+ /*
+ * Multiline comment goes here because this comment spans multiple lines.
+ * Multiline comment goes here because this comment spans multiple lines.
+ */
+ rb_define_const(cFoo, "MULTILINE", INT2FIX(1));
+
+ /*
+ * 1: Multiline comment goes here because this comment spans multiple lines.
+ * Multiline comment goes here because this comment spans multiple lines.
+ */
+ rb_define_const(cFoo, "MULTILINE_VALUE", INT2FIX(1));
+
+ /* Multiline comment goes here because this comment spans multiple lines.
+ * Multiline comment goes here because this comment spans multiple lines.
+ */
+ rb_define_const(cFoo, "MULTILINE_NOT_EMPTY", INT2FIX(1));
+
+}
+ EOF
+
+ @parser = util_parser content
+
+ @parser.do_classes
+ @parser.do_constants
+
+ klass = @parser.classes['cFoo']
+ assert klass
+
+ constants = klass.constants
+ assert !klass.constants.empty?
+
+ constants = constants.map { |c| [c.name, c.value, c.comment] }
+
+ assert_equal ['PERFECT', '300',
+ "\n The highest possible score in bowling \n "],
+ constants.shift
+ assert_equal ['CHEER', 'Huzzah!',
+ "\n What you cheer when you roll a perfect game \n "],
+ constants.shift
+ assert_equal ['TEST', 'TEST:TEST',
+ "\n Checking to see if escaped semicolon works \n "],
+ constants.shift
+ assert_equal ['MSEPARATOR', '\\',
+ "\n The file separator on MS Windows \n "],
+ constants.shift
+ assert_equal ['SEPARATOR', '/',
+ "\n The file separator on Unix \n "],
+ constants.shift
+ assert_equal ['STUFF', 'C:\\Program Files\\Stuff',
+ "\n A directory on MS Windows \n "],
+ constants.shift
+ assert_equal ['NOSEMI', 'INT2FIX(99)',
+ "\n Default definition \n "],
+ constants.shift
+ assert_equal ['NOCOMMENT', 'rb_str_new2("No comment")', nil],
+ constants.shift
+
+ comment = <<-EOF.chomp
+
+
+ Multiline comment goes here because this comment spans multiple lines.
+ Multiline comment goes here because this comment spans multiple lines.
+
+
+ EOF
+ assert_equal ['MULTILINE', 'INT2FIX(1)', comment], constants.shift
+ assert_equal ['MULTILINE_VALUE', '1', comment], constants.shift
+
+ comment = <<-EOF.chomp
+
+ Multiline comment goes here because this comment spans multiple lines.
+ Multiline comment goes here because this comment spans multiple lines.
+
+
+ EOF
+ assert_equal ['MULTILINE_NOT_EMPTY', 'INT2FIX(1)', comment], constants.shift
+
+ assert constants.empty?, constants.inspect
+ end
+
+ def test_find_class_comment_init
+ content = <<-EOF
+/*
+ * a comment for class Foo
+ */
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ assert_equal " \n a comment for class Foo\n \n", klass.comment
+ end
+
+ def test_find_class_comment_define_class
+ content = <<-EOF
+/*
+ * a comment for class Foo
+ */
+VALUE foo = rb_define_class("Foo", rb_cObject);
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ assert_equal " \n a comment for class Foo\n \n", klass.comment
+ end
+
+ def test_find_class_comment_define_class_Init_Foo
+ content = <<-EOF
+/*
+ * a comment for class Foo on Init
+ */
+void
+Init_Foo(void) {
+ /*
+ * a comment for class Foo on rb_define_class
+ */
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ assert_equal " \n a comment for class Foo on Init\n \n", klass.comment
+ end
+
+ def test_find_class_comment_define_class_bogus_comment
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+void
+other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+
+ assert_equal '', klass.comment
+ end
+
+ def test_find_body
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+VALUE
+other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+
+ rb_define_method(foo, "my_method", other_function, 0);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+ other_function = klass.method_list.first
+
+ assert_equal 'my_method', other_function.name
+ assert_equal " \n a comment for other_function\n \n",
+ other_function.comment
+ assert_equal '()', other_function.params
+
+ code = other_function.token_stream.first.text
+
+ assert_equal "VALUE\nother_function() ", code
+ end
+
+ def test_find_body_define
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+#define other_function rb_other_function
+
+/* */
+VALUE
+rb_other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+
+ rb_define_method(foo, "my_method", other_function, 0);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+ other_function = klass.method_list.first
+
+ assert_equal 'my_method', other_function.name
+ assert_equal " \n a comment for other_function\n \n \n",
+ other_function.comment
+ assert_equal '()', other_function.params
+
+ code = other_function.token_stream.first.text
+
+ assert_equal "#define other_function rb_other_function", code
+ end
+
+ def test_define_method
+ content = <<-EOF
+/*Method Comment! */
+static VALUE
+rb_io_s_read(argc, argv, io)
+ int argc;
+ VALUE *argv;
+ VALUE io;
+{
+}
+
+void
+Init_IO(void) {
+ /*
+ * a comment for class Foo on rb_define_class
+ */
+ VALUE rb_cIO = rb_define_class("IO", rb_cObject);
+ rb_define_singleton_method(rb_cIO, "read", rb_io_s_read, -1);
+}
+ EOF
+
+ klass = util_get_class content, 'rb_cIO'
+ read_method = klass.method_list.first
+ assert_equal "read", read_method.name
+ assert_equal " Method Comment! \n", read_method.comment
+ end
+
+ def test_define_method_private
+ content = <<-EOF
+/*Method Comment! */
+static VALUE
+rb_io_s_read(argc, argv, io)
+ int argc;
+ VALUE *argv;
+ VALUE io;
+{
+}
+
+void
+Init_IO(void) {
+ /*
+ * a comment for class Foo on rb_define_class
+ */
+ VALUE rb_cIO = rb_define_class("IO", rb_cObject);
+ rb_define_private_method(rb_cIO, "read", rb_io_s_read, -1);
+}
+ EOF
+
+ klass = util_get_class content, 'rb_cIO'
+ read_method = klass.method_list.first
+ assert_equal 'IO#read', read_method.full_name
+ assert_equal :private, read_method.visibility
+ assert_equal " Method Comment! \n", read_method.comment
+ end
+
+ def util_get_class(content, name)
+ @parser = util_parser content
+ @parser.scan
+ @parser.classes[name]
+ end
+
+ def util_parser(content)
+ RDoc::Parser::C.new @top_level, @fn, content, @options, @stats
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
new file mode 100644
index 000000000..165cadaa5
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
@@ -0,0 +1,74 @@
+require 'stringio'
+require 'tempfile'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/options'
+require 'rdoc/parser/perl'
+
+class TestRdocParserPerlPOD < MiniTest::Unit::TestCase
+
+ def setup
+ @tempfile = Tempfile.new self.class.name
+ filename = @tempfile.path
+
+ @top_level = RDoc::TopLevel.new filename
+ @fn = filename
+ @options = RDoc::Options.new
+ @stats = RDoc::Stats.new 0
+ end
+
+ def teardown
+ @tempfile.close
+ end
+
+ def test_uncommented_perl
+ content = <<-EOF
+while (<>) {
+ tr/a-z/A-Z;
+ print
+}
+ EOF
+
+ comment = util_get_comment content
+ assert_equal "", comment
+ end
+
+ def test_perl_without_pod
+ content = <<-EOF
+#!/usr/local/bin/perl
+#
+#This is a pointless perl program because it does -p.
+#
+while(<>) {print;}:
+ EOF
+
+ comment = util_get_comment content
+ assert_equal "", comment
+ end
+
+ def test_simple_pod_no_structure
+ content = <<-EOF
+=begin pod
+
+This just contains plain old documentation
+
+=end
+ EOF
+ comment = util_get_comment content
+ assert_equal "\nThis just contains plain old documentation\n\n", comment
+ end
+
+ # Get the comment of the @top_level when it has processed the input.
+ def util_get_comment(content)
+ parser = util_parser content
+ parser.scan.comment
+ end
+
+ # create a new parser with the supplied content.
+ def util_parser(content)
+ RDoc::Parser::PerlPOD.new @top_level, @fn, content, @options, @stats
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_ruby.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_ruby.rb
new file mode 100644
index 000000000..5fb880cb3
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_parser_ruby.rb
@@ -0,0 +1,1040 @@
+require 'stringio'
+require 'tempfile'
+require 'rubygems'
+require 'minitest/autorun'
+
+require 'rdoc/options'
+require 'rdoc/parser/ruby'
+require 'rdoc/stats'
+
+class TestRDocParserRuby < MiniTest::Unit::TestCase
+
+ def setup
+ @tempfile = Tempfile.new self.class.name
+ @filename = @tempfile.path
+
+ # Some tests need two paths.
+ @tempfile2 = Tempfile.new self.class.name
+ @filename2 = @tempfile2.path
+
+ util_top_level
+ @options = RDoc::Options.new
+ @options.quiet = true
+ @stats = RDoc::Stats.new 0
+ end
+
+ def teardown
+ @tempfile.close
+ @tempfile2.close
+ end
+
+ def test_look_for_directives_in_attr
+ util_parser ""
+
+ comment = "# :attr: my_attr\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :attr: my_attr\n", comment
+
+ comment = "# :attr_reader: my_method\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :attr_reader: my_method\n", comment
+
+ comment = "# :attr_writer: my_method\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :attr_writer: my_method\n", comment
+ end
+
+ def test_look_for_directives_in_commented
+ util_parser ""
+
+ comment = "# how to make a section:\n# # :section: new section\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ section = @top_level.current_section
+ assert_equal nil, section.title
+ assert_equal nil, section.comment
+
+ assert_equal "# how to make a section:\n# # :section: new section\n",
+ comment
+ end
+
+ def test_look_for_directives_in_enddoc
+ util_parser ""
+
+ assert_throws :enddoc do
+ @parser.look_for_directives_in @top_level, "# :enddoc:\n"
+ end
+ end
+
+ def test_look_for_directives_in_main
+ util_parser ""
+
+ @parser.look_for_directives_in @top_level, "# :main: new main page\n"
+
+ assert_equal 'new main page', @options.main_page
+ end
+
+ def test_look_for_directives_in_method
+ util_parser ""
+
+ comment = "# :method: my_method\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :method: my_method\n", comment
+
+ comment = "# :singleton-method: my_method\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :singleton-method: my_method\n", comment
+ end
+
+ def test_look_for_directives_in_startdoc
+ util_parser ""
+
+ @top_level.stop_doc
+ assert !@top_level.document_self
+ assert !@top_level.document_children
+ assert !@top_level.force_documentation
+
+ @parser.look_for_directives_in @top_level, "# :startdoc:\n"
+
+ assert @top_level.document_self
+ assert @top_level.document_children
+ assert @top_level.force_documentation
+ end
+
+ def test_look_for_directives_in_stopdoc
+ util_parser ""
+
+ assert @top_level.document_self
+ assert @top_level.document_children
+
+ @parser.look_for_directives_in @top_level, "# :stopdoc:\n"
+
+ assert !@top_level.document_self
+ assert !@top_level.document_children
+ end
+
+ def test_look_for_directives_in_section
+ util_parser ""
+
+ comment = "# :section: new section\n# woo stuff\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ section = @top_level.current_section
+ assert_equal 'new section', section.title
+ assert_equal "# woo stuff\n", section.comment
+
+ assert_equal '', comment
+ end
+
+ def test_look_for_directives_in_title
+ util_parser ""
+
+ @parser.look_for_directives_in @top_level, "# :title: new title\n"
+
+ assert_equal 'new title', @options.title
+ end
+
+ def test_look_for_directives_in_unhandled
+ util_parser ""
+
+ comment = "# :unhandled: \n# :title: hi\n"
+
+ @parser.look_for_directives_in @top_level, comment
+
+ assert_equal "# :unhandled: \n", comment
+
+ assert_equal 'hi', @options.title
+ end
+
+ def test_parse_attr
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my attr\n"
+
+ util_parser "attr :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ assert_equal 1, klass.attributes.length
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal "##\n# my attr\n", foo.comment
+ end
+
+ def test_parse_attr_accessor
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my attr\n"
+
+ util_parser "attr_accessor :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ assert_equal 2, klass.attributes.length
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'RW', foo.rw
+ assert_equal "##\n# my attr\n", foo.comment
+
+ bar = klass.attributes.last
+ assert_equal 'bar', bar.name
+ assert_equal 'RW', bar.rw
+ assert_equal "##\n# my attr\n", bar.comment
+ end
+
+ def test_parse_attr_accessor_writer
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my attr\n"
+
+ util_parser "attr_writer :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ assert_equal 2, klass.attributes.length
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'W', foo.rw
+ assert_equal "##\n# my attr\n", foo.comment
+
+ bar = klass.attributes.last
+ assert_equal 'bar', bar.name
+ assert_equal 'W', bar.rw
+ assert_equal "##\n# my attr\n", bar.comment
+ end
+
+ def test_parse_meta_attr
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :attr: \n# my method\n"
+
+ util_parser "add_my_method :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'RW', foo.rw
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_attr_accessor
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :attr_accessor: \n# my method\n"
+
+ util_parser "add_my_method :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'RW', foo.rw
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_attr_reader
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :attr_reader: \n# my method\n"
+
+ util_parser "add_my_method :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'R', foo.rw
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_attr_writer
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :attr_writer: \n# my method\n"
+
+ util_parser "add_my_method :foo, :bar"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'W', foo.rw
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_class
+ comment = "##\n# my method\n"
+
+ util_parser 'class Foo; end'
+
+ tk = @parser.get_tk
+
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = @top_level.classes.first
+ assert_equal 'Foo', foo.full_name
+ assert_equal comment, foo.comment
+ end
+
+ def test_parse_class_nested_superclass
+ foo = RDoc::NormalModule.new 'Foo'
+ foo.parent = @top_level
+
+ util_parser "class Bar < Super\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_class foo, RDoc::Parser::Ruby::NORMAL, tk, ''
+
+ bar = foo.classes.first
+ assert_equal 'Super', bar.superclass
+ end
+
+ def test_parse_module
+ comment = "##\n# my module\n"
+
+ util_parser 'module Foo; end'
+
+ tk = @parser.get_tk
+
+ @parser.parse_module @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = @top_level.modules.first
+ assert_equal 'Foo', foo.full_name
+ assert_equal comment, foo.comment
+ end
+
+ def test_parse_class_mistaken_for_module
+ # The code below is not strictly legal Ruby (Foo must have been defined
+ # before Foo::Bar is encountered), but RDoc might encounter Foo::Bar
+ # before Foo if they live in different files.
+
+ code = <<-EOF
+class Foo::Bar
+end
+
+module Foo::Baz
+end
+
+class Foo
+end
+ EOF
+
+ util_parser code
+
+ @parser.scan
+
+ assert_equal %w[Foo::Baz], RDoc::TopLevel.modules_hash.keys
+ assert_empty @top_level.modules
+
+ foo = @top_level.classes.first
+ assert_equal 'Foo', foo.full_name
+
+ bar = foo.classes.first
+ assert_equal 'Foo::Bar', bar.full_name
+
+ baz = foo.modules.first
+ assert_equal 'Foo::Baz', baz.full_name
+ end
+
+ def test_parse_class_definition_encountered_after_class_reference
+ # The code below is not strictly legal Ruby (Foo must have been defined
+ # before Foo.bar is encountered), but RDoc might encounter Foo.bar before
+ # Foo if they live in different files.
+
+ code = <<-EOF
+def Foo.bar
+end
+
+class Foo < IO
+end
+ EOF
+
+ util_parser code
+
+ @parser.scan
+
+ assert_empty RDoc::TopLevel.modules_hash
+ # HACK why does it fail?
+ #assert_empty @top_level.modules
+
+ foo = @top_level.classes.first
+ assert_equal 'Foo', foo.full_name
+ assert_equal 'IO', foo.superclass
+
+ bar = foo.method_list.first
+ assert_equal 'bar', bar.name
+ end
+
+ def test_parse_module_relative_to_top_level_namespace
+ comment = <<-EOF
+#
+# Weirdly named module
+#
+EOF
+
+ code = comment + <<-EOF
+module ::Foo
+ class Helper
+ end
+end
+EOF
+
+ util_parser code
+ @parser.scan()
+
+ foo = @top_level.modules.first
+ assert_equal 'Foo', foo.full_name
+ assert_equal comment, foo.comment
+
+ helper = foo.classes.first
+ assert_equal 'Foo::Helper', helper.full_name
+ end
+
+ def test_parse_comment_attr
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :attr: foo\n# my attr\n"
+
+ util_parser "\n"
+
+ tk = @parser.get_tk
+
+ @parser.parse_comment klass, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'RW', foo.rw
+ assert_equal comment, foo.comment
+
+ assert_equal nil, foo.viewer
+ assert_equal true, foo.document_children
+ assert_equal true, foo.document_self
+ assert_equal false, foo.done_documenting
+ assert_equal false, foo.force_documentation
+ assert_equal klass, foo.parent
+ assert_equal :public, foo.visibility
+ assert_equal "\n", foo.text
+ assert_equal klass.current_section, foo.section
+ end
+
+ def test_parse_comment_method
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :method: foo\n# my method\n"
+
+ util_parser "\n"
+
+ tk = @parser.get_tk
+
+ @parser.parse_comment klass, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal comment, foo.comment
+
+ assert_equal [], foo.aliases
+ assert_equal nil, foo.block_params
+ assert_equal nil, foo.call_seq
+ assert_equal nil, foo.is_alias_for
+ assert_equal nil, foo.viewer
+ assert_equal true, foo.document_children
+ assert_equal true, foo.document_self
+ assert_equal '', foo.params
+ assert_equal false, foo.done_documenting
+ assert_equal false, foo.dont_rename_initialize
+ assert_equal false, foo.force_documentation
+ assert_equal klass, foo.parent
+ assert_equal false, foo.singleton
+ assert_equal :public, foo.visibility
+ assert_equal "\n", foo.text
+ assert_equal klass.current_section, foo.section
+
+ stream = [
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ RDoc::Parser::Ruby::NEWLINE_TOKEN,
+ tk(:SPACE, 1, 1, nil, ''),
+ ]
+
+ assert_equal stream, foo.token_stream
+ end
+
+ def test_parse_meta_method
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal comment, foo.comment
+
+ assert_equal [], foo.aliases
+ assert_equal nil, foo.block_params
+ assert_equal nil, foo.call_seq
+ assert_equal true, foo.document_children
+ assert_equal true, foo.document_self
+ assert_equal false, foo.done_documenting
+ assert_equal false, foo.dont_rename_initialize
+ assert_equal false, foo.force_documentation
+ assert_equal nil, foo.is_alias_for
+ assert_equal '', foo.params
+ assert_equal klass, foo.parent
+ assert_equal false, foo.singleton
+ assert_equal 'add_my_method :foo', foo.text
+ assert_equal nil, foo.viewer
+ assert_equal :public, foo.visibility
+ assert_equal klass.current_section, foo.section
+
+ stream = [
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ RDoc::Parser::Ruby::NEWLINE_TOKEN,
+ tk(:SPACE, 1, 1, nil, ''),
+ tk(:IDENTIFIER, 1, 0, 'add_my_method', 'add_my_method'),
+ tk(:SPACE, 1, 13, nil, ' '),
+ tk(:SYMBOL, 1, 14, nil, ':foo'),
+ tk(:COMMA, 1, 18, nil, ','),
+ tk(:SPACE, 1, 19, nil, ' '),
+ tk(:SYMBOL, 1, 20, nil, ':bar'),
+ tk(:NL, 1, 24, nil, "\n"),
+ ]
+
+ assert_equal stream, foo.token_stream
+ end
+
+ def test_parse_meta_method_name
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :method: woo_hoo!\n# my method\n"
+
+ util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'woo_hoo!', foo.name
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_method_singleton
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :singleton-method:\n# my method\n"
+
+ util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal true, foo.singleton, 'singleton method'
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_method_singleton_name
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# :singleton-method: woo_hoo!\n# my method\n"
+
+ util_parser "add_my_method :foo, :bar\nadd_my_method :baz"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'woo_hoo!', foo.name
+ assert_equal true, foo.singleton, 'singleton method'
+ assert_equal "##\n# my method\n", foo.comment
+ end
+
+ def test_parse_meta_method_string_name
+ klass = RDoc::NormalClass.new 'Foo'
+ comment = "##\n# my method\n"
+
+ util_parser "add_my_method 'foo'"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal comment, foo.comment
+ end
+
+ def test_parse_meta_method_unknown
+ klass = RDoc::NormalClass.new 'Foo'
+ comment = "##\n# my method\n"
+
+ util_parser "add_my_method ('foo')"
+
+ tk = @parser.get_tk
+
+ @parser.parse_meta_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'unknown', foo.name
+ assert_equal comment, foo.comment
+ end
+
+ def test_parse_method
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def foo() :bar end"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal comment, foo.comment
+
+ assert_equal [], foo.aliases
+ assert_equal nil, foo.block_params
+ assert_equal nil, foo.call_seq
+ assert_equal nil, foo.is_alias_for
+ assert_equal nil, foo.viewer
+ assert_equal true, foo.document_children
+ assert_equal true, foo.document_self
+ assert_equal '()', foo.params
+ assert_equal false, foo.done_documenting
+ assert_equal false, foo.dont_rename_initialize
+ assert_equal false, foo.force_documentation
+ assert_equal klass, foo.parent
+ assert_equal false, foo.singleton
+ assert_equal :public, foo.visibility
+ assert_equal 'def foo', foo.text
+ assert_equal klass.current_section, foo.section
+
+ stream = [
+ tk(:COMMENT, 1, 1, nil, "# File #{@top_level.absolute_name}, line 1"),
+ RDoc::Parser::Ruby::NEWLINE_TOKEN,
+ tk(:SPACE, 1, 1, nil, ''),
+ tk(:DEF, 1, 0, 'def', 'def'),
+ tk(:SPACE, 1, 3, nil, ' '),
+ tk(:IDENTIFIER, 1, 4, 'foo', 'foo'),
+ tk(:LPAREN, 1, 7, nil, '('),
+ tk(:RPAREN, 1, 8, nil, ')'),
+ tk(:SPACE, 1, 9, nil, ' '),
+ tk(:COLON, 1, 10, nil, ':'),
+ tk(:IDENTIFIER, 1, 11, 'bar', 'bar'),
+ tk(:SPACE, 1, 14, nil, ' '),
+ tk(:END, 1, 15, 'end', 'end'),
+ ]
+
+ assert_equal stream, foo.token_stream
+ end
+
+ def test_parse_method_funky
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def (blah).foo() :bar end"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ assert klass.method_list.empty?
+ end
+
+ def test_parse_method_no_parens
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def foo arg1, arg2\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal '(arg1, arg2)', foo.params
+ end
+
+ def test_parse_method_parameters_comment
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def foo arg1, arg2 # some useful comment\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal '(arg1, arg2)', foo.params
+ end
+
+ def test_parse_method_parameters_comment_continue
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def foo arg1, arg2, # some useful comment\narg3\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ foo = klass.method_list.first
+ assert_equal '(arg1, arg2, arg3)', foo.params
+ end
+
+ def test_parse_method_toplevel
+ klass = @top_level
+
+ comment = "##\n# my method\n"
+
+ util_parser "def foo arg1, arg2\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ object = RDoc::TopLevel.find_class_named 'Object'
+
+ foo = object.method_list.first
+ assert_equal 'Object#foo', foo.full_name
+ end
+
+ def test_parse_statements_class_if
+ comment = "##\n# my method\n"
+
+ util_parser <<-CODE
+module Foo
+ X = if TRUE then
+ ''
+ end
+
+ def blah
+ end
+end
+ CODE
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.modules.first
+ assert_equal 'Foo', foo.full_name, 'module Foo'
+
+ methods = foo.method_list
+ assert_equal 1, methods.length
+ assert_equal 'Foo#blah', methods.first.full_name
+ end
+
+ def test_parse_statements_class_nested
+ comment = "##\n# my method\n"
+
+ util_parser "module Foo\n#{comment}class Bar\nend\nend"
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.modules.first
+ assert_equal 'Foo', foo.full_name, 'module Foo'
+
+ bar = foo.classes.first
+ assert_equal 'Foo::Bar', bar.full_name, 'class Foo::Bar'
+ assert_equal comment, bar.comment
+ end
+
+ def test_parse_statements_identifier_meta_method
+ content = <<-EOF
+class Foo
+ ##
+ # this is my method
+ add_my_method :foo
+end
+ EOF
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.method_list.first
+ assert_equal 'foo', foo.name
+ end
+
+ def test_parse_statements_identifier_alias_method
+ content = "class Foo def foo() end; alias_method :foo2, :foo end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.method_list[0]
+ assert_equal 'foo', foo.name
+
+ foo2 = @top_level.classes.first.method_list.last
+ assert_equal 'foo2', foo2.name
+ assert_equal 'foo', foo2.is_alias_for.name
+ assert @top_level.classes.first.aliases.empty?
+ end
+
+ def test_parse_statements_identifier_alias_method_before_original_method
+ # This is not strictly legal Ruby code, but it simulates finding an alias
+ # for a method before finding the original method, which might happen
+ # to rdoc if the alias is in a different file than the original method
+ # and rdoc processes the alias' file first.
+ content = <<-EOF
+class Foo
+ alias_method :foo2, :foo
+
+ alias_method :foo3, :foo
+
+ def foo()
+ end
+
+ alias_method :foo4, :foo
+
+ alias_method :foo5, :unknown
+end
+EOF
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.method_list[0]
+ assert_equal 'foo', foo.name
+
+ foo2 = @top_level.classes.first.method_list[1]
+ assert_equal 'foo2', foo2.name
+ assert_equal 'foo', foo2.is_alias_for.name
+
+ foo3 = @top_level.classes.first.method_list[2]
+ assert_equal 'foo3', foo3.name
+ assert_equal 'foo', foo3.is_alias_for.name
+
+ foo4 = @top_level.classes.first.method_list.last
+ assert_equal 'foo4', foo4.name
+ assert_equal 'foo', foo4.is_alias_for.name
+
+ assert_equal 'unknown', @top_level.classes.first.aliases[0].old_name
+ end
+
+ def test_parse_statements_identifier_constant
+ content = <<-EOF
+class Foo
+ FIRST_CONSTANT = 5
+
+ SECOND_CONSTANT = [
+ 1,
+ 2,
+ 3
+ ]
+
+ THIRD_CONSTANT = {
+ :foo => 'bar',
+ :x => 'y'
+ }
+
+ FOURTH_CONSTANT = SECOND_CONSTANT.map do |element|
+ element + 1
+ element + 2
+ end
+
+ FIFTH_CONSTANT = SECOND_CONSTANT.map { |element| element + 1 }
+end
+EOF
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ constants = @top_level.classes.first.constants
+
+ constant = constants[0]
+ assert_equal 'FIRST_CONSTANT', constant.name
+ assert_equal '5', constant.value
+
+ constant = constants[1]
+ assert_equal 'SECOND_CONSTANT', constant.name
+ assert_equal '[ 1, 2, 3 ]', constant.value
+
+ constant = constants[2]
+ assert_equal 'THIRD_CONSTANT', constant.name
+ assert_equal "{ :foo => 'bar', :x => 'y' }", constant.value
+
+ constant = constants[3]
+ assert_equal 'FOURTH_CONSTANT', constant.name
+ assert_equal 'SECOND_CONSTANT.map do |element| element + 1 element + 2 end', constant.value
+
+ constant = constants.last
+ assert_equal 'FIFTH_CONSTANT', constant.name
+ assert_equal 'SECOND_CONSTANT.map { |element| element + 1 }', constant.value
+ end
+
+ def test_parse_statements_identifier_attr
+ content = "class Foo; attr :foo; end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'R', foo.rw
+ end
+
+ def test_parse_statements_identifier_attr_accessor
+ content = "class Foo; attr_accessor :foo; end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'RW', foo.rw
+ end
+
+ def test_parse_statements_identifier_include
+ content = "class Foo; include Bar; end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first
+ assert_equal 'Foo', foo.name
+ assert_equal 1, foo.includes.length
+ end
+
+ def test_parse_statements_identifier_module_function
+ content = "module Foo def foo() end; module_function :foo; end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo, s_foo = @top_level.modules.first.method_list
+ assert_equal 'foo', foo.name, 'instance method name'
+ assert_equal :private, foo.visibility, 'instance method visibility'
+ assert_equal false, foo.singleton, 'instance method singleton'
+
+ assert_equal 'foo', s_foo.name, 'module function name'
+ assert_equal :public, s_foo.visibility, 'module function visibility'
+ assert_equal true, s_foo.singleton, 'module function singleton'
+ end
+
+ def test_parse_statements_identifier_private
+ content = "class Foo private; def foo() end end"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ foo = @top_level.classes.first.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal :private, foo.visibility
+ end
+
+ def test_parse_statements_identifier_require
+ content = "require 'bar'"
+
+ util_parser content
+
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil, ''
+
+ assert_equal 1, @top_level.requires.length
+ end
+
+ def tk(klass, line, char, name, text)
+ klass = RDoc::RubyToken.const_get "Tk#{klass.to_s.upcase}"
+
+ token = if klass.instance_method(:initialize).arity == 2 then
+ raise ArgumentError, "name not used for #{klass}" unless name.nil?
+ klass.new line, char
+ else
+ klass.new line, char, name
+ end
+
+ token.set_text text
+
+ token
+ end
+
+ def util_parser(content)
+ @parser = RDoc::Parser::Ruby.new @top_level, @filename, content, @options,
+ @stats
+ end
+
+ def util_two_parsers(first_file_content, second_file_content)
+ util_parser first_file_content
+
+ @parser2 = RDoc::Parser::Ruby.new @top_level2, @filename,
+ second_file_content, @options, @stats
+ end
+
+ def util_top_level
+ RDoc::TopLevel.reset
+ @top_level = RDoc::TopLevel.new @filename
+ @top_level2 = RDoc::TopLevel.new @filename2
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_require.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_require.rb
new file mode 100644
index 000000000..d5850bd16
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_require.rb
@@ -0,0 +1,25 @@
+require 'test/xref_test_case'
+
+class TestRDocRequire < XrefTestCase
+
+ def setup
+ super
+
+ @req = RDoc::Require.new 'foo', 'comment'
+ end
+
+ def test_initialize
+ assert_equal 'foo', @req.name
+
+ req = RDoc::Require.new '"foo"', ''
+ assert_equal 'foo', @req.name
+
+ req = RDoc::Require.new '\'foo\'', ''
+ assert_equal 'foo', @req.name
+
+ req = RDoc::Require.new '|foo|', ''
+ assert_equal 'foo', @req.name, 'for fortran?'
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_attribute_formatter.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_attribute_formatter.rb
new file mode 100644
index 000000000..a86312618
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_attribute_formatter.rb
@@ -0,0 +1,44 @@
+require 'stringio'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/ri/formatter'
+
+class TestRDocRIAttributeFormatter < MiniTest::Unit::TestCase
+
+ def setup
+ @output = StringIO.new
+ @width = 78
+ @indent = ' '
+
+ @f = RDoc::RI::AttributeFormatter.new @output, @width, @indent
+ end
+
+ def test_wrap_empty
+ @f.wrap ''
+ assert_equal '', @output.string
+ end
+
+ def test_wrap_long
+ @f.wrap 'a ' * (@width / 2)
+ assert_equal " a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \n a \n",
+ @output.string
+ end
+
+ def test_wrap_markup
+ @f.wrap 'a <tt>b</tt> c'
+ assert_equal " a b c\n", @output.string
+ end
+
+ def test_wrap_nil
+ @f.wrap nil
+ assert_equal '', @output.string
+ end
+
+ def test_wrap_short
+ @f.wrap 'a b c'
+ assert_equal " a b c\n", @output.string
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_default_display.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_default_display.rb
new file mode 100644
index 000000000..54b900642
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_default_display.rb
@@ -0,0 +1,302 @@
+require 'stringio'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/ri/formatter'
+require 'rdoc/ri/display'
+require 'rdoc/ri/driver'
+
+class TestRDocRiDefaultDisplay < MiniTest::Unit::TestCase
+
+ def setup
+ @output = StringIO.new
+ @width = 78
+ @indent = ' '
+
+ @dd = RDoc::RI::DefaultDisplay.new RDoc::RI::Formatter, @width, true,
+ @output
+
+ @some_method = h \
+ 'aliases' => [{'name' => 'some_method_alias'}],
+ 'block_params' => 'block_param',
+ 'comment' => [RDoc::Markup::Flow::P.new('some comment')],
+ 'full_name' => 'SomeClass#some_method',
+ 'is_singleton' => false,
+ 'name' => 'some_method',
+ 'params' => '(arg1, arg2) {|block_param| ...}',
+ 'source_path' => '/nonexistent',
+ 'visibility' => 'public'
+ end
+
+ def test_display_class_info
+ klass = h \
+ 'attributes' => [
+ { 'name' => 'attribute', 'rw' => 'RW',
+ 'comment' => [RDoc::Markup::Flow::P.new('attribute comment')] },
+ { 'name' => 'attribute_no_comment', 'rw' => 'RW',
+ 'comment' => nil },
+ ],
+ 'class_methods' => [
+ { 'name' => 'class_method' },
+ ],
+ 'class_method_extensions' => [
+ { 'name' => 'class_method_extension' },
+ ],
+ 'comment' => [RDoc::Markup::Flow::P.new('SomeClass comment')],
+ 'constants' => [
+ { 'name' => 'CONSTANT', 'value' => '"value1"',
+ 'comment' => [RDoc::Markup::Flow::P.new('CONSTANT value')] },
+ { 'name' => 'CONSTANT_NOCOMMENT', 'value' => '"value2"',
+ 'comment' => nil },
+ ],
+ 'display_name' => 'Class',
+ 'full_name' => 'SomeClass',
+ 'includes' => [],
+ 'instance_methods' => [
+ { 'name' => 'instance_method' },
+ { 'name' => 'instance_method2' },
+ ],
+ 'instance_method_extensions' => [
+ { 'name' => 'instance_method_extension' },
+ ],
+ 'superclass' => 'Object'
+
+ @dd.display_class_info klass
+
+ expected = <<-EOF
+---------------------------------------------------- Class: SomeClass < Object
+ SomeClass comment
+
+------------------------------------------------------------------------------
+
+
+Constants:
+----------
+
+ CONSTANT = "value1"
+ CONSTANT value
+
+ CONSTANT_NOCOMMENT = "value2"
+
+
+Attributes:
+-----------
+
+ attribute (RW):
+ attribute comment
+
+ attribute_no_comment (RW)
+
+
+Class methods:
+--------------
+
+ class_method
+
+
+Class method extensions:
+------------------------
+
+ class_method_extension
+
+
+Instance methods:
+-----------------
+
+ instance_method, instance_method2
+
+
+Instance method extensions:
+---------------------------
+
+ instance_method_extension
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_flow
+ flow = [RDoc::Markup::Flow::P.new('flow')]
+
+ @dd.display_flow flow
+
+ assert_equal " flow\n\n", @output.string
+ end
+
+ def test_display_flow_empty
+ @dd.display_flow []
+
+ assert_equal " [no description]\n", @output.string
+ end
+
+ def test_display_flow_nil
+ @dd.display_flow nil
+
+ assert_equal " [no description]\n", @output.string
+ end
+
+ def test_display_method_info
+ @dd.display_method_info @some_method
+
+ expected = <<-EOF
+-------------------------------------------------------- SomeClass#some_method
+ some_method(arg1, arg2) {|block_param| ...}
+
+ From /nonexistent
+------------------------------------------------------------------------------
+ some comment
+
+
+ (also known as some_method_alias)
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_method_info_singleton
+ method = RDoc::RI::Driver::OpenStructHash.new.update \
+ 'aliases' => [],
+ 'block_params' => nil,
+ 'comment' => nil,
+ 'full_name' => 'SomeClass::some_method',
+ 'is_singleton' => true,
+ 'name' => 'some_method',
+ 'params' => '(arg1, arg2)',
+ 'visibility' => 'public'
+
+ @dd.display_method_info method
+
+ expected = <<-EOF
+------------------------------------------------------- SomeClass::some_method
+ SomeClass::some_method(arg1, arg2)
+
+ From
+------------------------------------------------------------------------------
+ [no description]
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_method_list
+ methods = [
+ RDoc::RI::Driver::OpenStructHash.new.update(
+ "aliases" => [],
+ "block_params" => nil,
+ "comment" => nil,
+ "full_name" => "SomeClass#some_method",
+ "is_singleton" => false,
+ "name" => "some_method",
+ "params" => "()",
+ "visibility" => "public"
+ ),
+ RDoc::RI::Driver::OpenStructHash.new.update(
+ "aliases" => [],
+ "block_params" => nil,
+ "comment" => nil,
+ "full_name" => "SomeClass#some_other_method",
+ "is_singleton" => false,
+ "name" => "some_other_method",
+ "params" => "()",
+ "visibility" => "public"
+ ),
+ ]
+
+ @dd.display_method_list methods
+
+ expected = <<-EOF
+ More than one method matched your request. You can refine your search by
+ asking for information on one of:
+
+SomeClass#some_method []
+SomeClass#some_other_method []
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_params
+ @dd.display_params @some_method
+
+ expected = <<-EOF
+ some_method(arg1, arg2) {|block_param| ...}
+
+ From /nonexistent
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_params_multiple
+ @some_method['params'] = <<-EOF
+some_method(index)
+some_method(start, length)
+ EOF
+
+ @dd.display_params @some_method
+
+ expected = <<-EOF
+ some_method(index)
+ some_method(start, length)
+
+ From /nonexistent
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_params_singleton
+ @some_method['is_singleton'] = true
+ @some_method['full_name'] = 'SomeClass::some_method'
+
+ @dd.display_params @some_method
+
+ expected = <<-EOF
+ SomeClass::some_method(arg1, arg2) {|block_param| ...}
+
+ From /nonexistent
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_list_known_classes
+ klasses = %w[SomeClass SomeModule]
+
+ @dd.list_known_classes klasses
+
+ expected = <<-EOF
+---------------------------------------------------- Known classes and modules
+
+ SomeClass
+ SomeModule
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_list_known_classes_empty
+ @dd.list_known_classes []
+
+ expected = <<-EOF
+No ri data found
+
+If you've installed Ruby yourself, you need to generate documentation using:
+
+ make install-doc
+
+from the same place you ran `make` to build ruby.
+
+If you installed Ruby from a packaging system, then you may need to
+install an additional package, or ask the packager to enable ri generation.
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def h(hash)
+ RDoc::RI::Driver::OpenStructHash.convert hash
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_driver.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_driver.rb
new file mode 100644
index 000000000..f16049205
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_driver.rb
@@ -0,0 +1,94 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'tmpdir'
+require 'rdoc/ri/driver'
+
+class TestRDocRIDriver < MiniTest::Unit::TestCase
+
+ def setup
+ @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
+ @home_ri = File.join @tmpdir, 'dot_ri'
+ @cache_dir = File.join @home_ri, 'cache'
+ @class_cache = File.join @cache_dir, 'classes'
+
+ FileUtils.mkdir_p @tmpdir
+ FileUtils.mkdir_p @home_ri
+ FileUtils.mkdir_p @cache_dir
+
+ @driver = RDoc::RI::Driver.new(RDoc::RI::Driver.process_args([]))
+ @driver.homepath = @home_ri
+ end
+
+ def teardown
+ FileUtils.rm_rf @tmpdir
+ end
+
+ def test_lookup_method
+ def @driver.load_cache_for(klassname)
+ { 'Foo#bar' => :found }
+ end
+
+ assert @driver.lookup_method('Foo#bar', 'Foo')
+ end
+
+ def test_lookup_method_class_method
+ def @driver.load_cache_for(klassname)
+ { 'Foo::Bar' => :found }
+ end
+
+ assert @driver.lookup_method('Foo::Bar', 'Foo::Bar')
+ end
+
+ def test_lookup_method_class_missing
+ def @driver.load_cache_for(klassname) end
+
+ assert_nil @driver.lookup_method('Foo#bar', 'Foo')
+ end
+
+ def test_lookup_method_dot_instance
+ def @driver.load_cache_for(klassname)
+ { 'Foo#bar' => :instance, 'Foo::bar' => :klass }
+ end
+
+ assert_equal :instance, @driver.lookup_method('Foo.bar', 'Foo')
+ end
+
+ def test_lookup_method_dot_class
+ def @driver.load_cache_for(klassname)
+ { 'Foo::bar' => :found }
+ end
+
+ assert @driver.lookup_method('Foo.bar', 'Foo')
+ end
+
+ def test_lookup_method_method_missing
+ def @driver.load_cache_for(klassname) {} end
+
+ assert_nil @driver.lookup_method('Foo#bar', 'Foo')
+ end
+
+ def test_parse_name
+ klass, meth = @driver.parse_name 'Foo::Bar'
+
+ assert_equal 'Foo::Bar', klass, 'Foo::Bar class'
+ assert_equal nil, meth, 'Foo::Bar method'
+
+ klass, meth = @driver.parse_name 'Foo#Bar'
+
+ assert_equal 'Foo', klass, 'Foo#Bar class'
+ assert_equal 'Bar', meth, 'Foo#Bar method'
+
+ klass, meth = @driver.parse_name 'Foo.Bar'
+
+ assert_equal 'Foo', klass, 'Foo#Bar class'
+ assert_equal 'Bar', meth, 'Foo#Bar method'
+
+ klass, meth = @driver.parse_name 'Foo::bar'
+
+ assert_equal 'Foo', klass, 'Foo::bar class'
+ assert_equal 'bar', meth, 'Foo::bar method'
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_formatter.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_formatter.rb
new file mode 100644
index 000000000..a70f9dcba
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_formatter.rb
@@ -0,0 +1,320 @@
+require 'stringio'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/ri/formatter'
+require 'rdoc/markup/to_flow'
+
+class TestRDocRIFormatter < MiniTest::Unit::TestCase
+
+ def setup
+ @output = StringIO.new
+ @width = 78
+ @indent = ' '
+
+ @f = RDoc::RI::Formatter.new @output, @width, @indent
+ @markup = RDoc::Markup.new
+ @flow = RDoc::Markup::ToFlow.new
+ end
+
+ def test_blankline
+ @f.blankline
+
+ assert_equal "\n", @output.string
+ end
+
+ def test_bold_print
+ @f.bold_print 'a b c'
+
+ assert_equal 'a b c', @output.string
+ end
+
+ def test_break_to_newline
+ @f.break_to_newline
+
+ assert_equal '', @output.string
+ end
+
+ def test_conv_html
+ assert_equal '> < " &', @f.conv_html('&gt; &lt; &quot; &amp;')
+ end
+
+ def test_conv_markup
+ text = '<tt>a</tt> <code>b</code> <b>c</b> <em>d</em>'
+
+ expected = '+a+ +b+ *c* _d_'
+
+ assert_equal expected, @f.conv_markup(text)
+ end
+
+ def test_display_flow
+ flow = [
+ RDoc::Markup::Flow::H.new(1, 'heading'),
+ RDoc::Markup::Flow::P.new('paragraph'),
+ ]
+
+ @f.display_flow flow
+
+ assert_equal "\nHEADING\n=======\n\n paragraph\n\n", @output.string
+ end
+
+ def test_display_flow_item_h
+ item = RDoc::Markup::Flow::H.new 1, 'heading'
+
+ @f.display_flow_item item
+
+ assert_equal "\nHEADING\n=======\n\n", @output.string
+ end
+
+ def test_display_flow_item_li
+ item = RDoc::Markup::Flow::LI.new nil, 'paragraph'
+
+ @f.display_flow_item item
+
+ assert_equal " paragraph\n\n", @output.string
+ end
+
+ def test_display_flow_item_list
+ item = RDoc::Markup::Flow::LIST.new :NUMBER
+
+ @f.display_flow_item item
+
+ assert_equal "", @output.string
+ end
+
+ def test_display_flow_item_p
+ item = RDoc::Markup::Flow::P.new 'paragraph'
+
+ @f.display_flow_item item
+
+ assert_equal " paragraph\n\n", @output.string
+ end
+
+ def test_display_flow_item_rule
+ item = RDoc::Markup::Flow::RULE.new 1
+
+ @f.display_flow_item item
+
+ assert_equal "#{'-' * 78}\n", @output.string
+ end
+
+ def test_display_flow_item_unknown
+ e = assert_raises RDoc::Error do
+ @f.display_flow_item Object.new
+ end
+
+ assert_equal "Unknown flow element: Object", e.message
+ end
+
+ def test_display_flow_item_verb
+ item = RDoc::Markup::Flow::VERB.new 'a b c'
+
+ @f.display_flow_item item
+
+ assert_equal " a b c\n\n", @output.string
+ end
+
+ def test_display_heading_1
+ @f.display_heading 'heading', 1, ' '
+
+ assert_equal "\nHEADING\n=======\n\n", @output.string
+ end
+
+ def test_display_heading_2
+ @f.display_heading 'heading', 2, ' '
+
+ assert_equal "\nheading\n-------\n\n", @output.string
+ end
+
+ def test_display_heading_3
+ @f.display_heading 'heading', 3, ' '
+
+ assert_equal " heading\n\n", @output.string
+ end
+
+ def test_display_list
+ list = RDoc::Markup::Flow::LIST.new :NUMBER
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+ list << RDoc::Markup::Flow::LI.new(nil, 'd e f')
+
+ @f.display_list list
+
+ assert_equal " 1. a b c\n\n 2. d e f\n\n", @output.string
+ end
+
+ def test_display_list_bullet
+ list = RDoc::Markup::Flow::LIST.new :BULLET
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+
+ @f.display_list list
+
+ assert_equal " * a b c\n\n", @output.string
+ end
+
+ def test_display_list_labeled
+ list = RDoc::Markup::Flow::LIST.new :LABELED
+ list << RDoc::Markup::Flow::LI.new('label', 'a b c')
+
+ @f.display_list list
+
+ assert_equal " label a b c\n\n", @output.string
+ end
+
+ def test_display_list_lower_alpha
+ list = RDoc::Markup::Flow::LIST.new :LOWERALPHA
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+
+ @f.display_list list
+
+ assert_equal " a. a b c\n\n", @output.string
+ end
+
+ def test_display_list_note
+ list = RDoc::Markup::Flow::LIST.new :NOTE
+ list << RDoc::Markup::Flow::LI.new('note:', 'a b c')
+
+ @f.display_list list
+
+ assert_equal " note: a b c\n\n", @output.string
+ end
+
+ def test_display_list_number
+ list = RDoc::Markup::Flow::LIST.new :NUMBER
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+
+ @f.display_list list
+
+ assert_equal " 1. a b c\n\n", @output.string
+ end
+
+ def test_display_list_unknown
+ list = RDoc::Markup::Flow::LIST.new :UNKNOWN
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+
+ e = assert_raises ArgumentError do
+ @f.display_list list
+ end
+
+ assert_equal 'unknown list type UNKNOWN', e.message
+ end
+
+ def test_display_list_upper_alpha
+ list = RDoc::Markup::Flow::LIST.new :UPPERALPHA
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+
+ @f.display_list list
+
+ assert_equal " A. a b c\n\n", @output.string
+ end
+
+ def test_display_verbatim_flow_item
+ verbatim = RDoc::Markup::Flow::VERB.new "a b c\nd e f"
+
+ @f.display_verbatim_flow_item verbatim
+
+ assert_equal " a b c\n d e f\n\n", @output.string
+ end
+
+ def test_display_verbatim_flow_item_bold
+ verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
+
+ @f.display_verbatim_flow_item verbatim
+
+ assert_equal " *a* b c\n\n", @output.string
+ end
+
+ def test_draw_line
+ @f.draw_line
+
+ expected = '-' * @width + "\n"
+ assert_equal expected, @output.string
+ end
+
+ def test_draw_line_label
+ @f.draw_line 'label'
+
+ expected = '-' * (@width - 6) + " label\n"
+ assert_equal expected, @output.string
+ end
+
+ def test_draw_line_label_long
+ @f.draw_line 'a' * @width
+
+ expected = '-' * @width + "\n" + ('a' * @width) + "\n"
+ assert_equal expected, @output.string
+ end
+
+ def test_raw_print_line
+ @f.raw_print_line 'a b c'
+
+ assert_equal "a b c", @output.string
+ end
+
+ def test_strip_attributes_b
+ text = @f.strip_attributes 'hello <b>world</b>'
+
+ expected = 'hello world'
+
+ assert_equal expected, text
+ end
+
+ def test_strip_attributes_code
+ text = @f.strip_attributes 'hello <code>world</code>'
+
+ expected = 'hello world'
+
+ assert_equal expected, text
+ end
+
+ def test_strip_attributes_em
+ text = @f.strip_attributes 'hello <em>world</em>'
+
+ expected = 'hello world'
+
+ assert_equal expected, text
+ end
+
+ def test_strip_attributes_i
+ text = @f.strip_attributes 'hello <i>world</i>'
+
+ expected = 'hello world'
+
+ assert_equal expected, text
+ end
+
+ def test_strip_attributes_tt
+ text = @f.strip_attributes 'hello <tt>world</tt>'
+
+ expected = 'hello world'
+
+ assert_equal expected, text
+ end
+
+ def test_wrap_empty
+ @f.wrap ''
+ assert_equal '', @output.string
+ end
+
+ def test_wrap_long
+ @f.wrap 'a ' * (@width / 2)
+ assert_equal " a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a\n a \n",
+ @output.string
+ end
+
+ def test_wrap_markup
+ @f.wrap 'a <tt>b</tt> c'
+ assert_equal " a +b+ c\n", @output.string
+ end
+
+ def test_wrap_nil
+ @f.wrap nil
+ assert_equal '', @output.string
+ end
+
+ def test_wrap_short
+ @f.wrap 'a b c'
+ assert_equal " a b c\n", @output.string
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_html_formatter.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_html_formatter.rb
new file mode 100644
index 000000000..2206cd631
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_html_formatter.rb
@@ -0,0 +1,141 @@
+require 'stringio'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/ri/formatter'
+require 'rdoc/markup/fragments'
+require 'rdoc/markup/to_flow'
+
+class TestRDocRIHtmlFormatter < MiniTest::Unit::TestCase
+
+ def setup
+ @output = StringIO.new
+ @width = 78
+ @indent = ' '
+
+ @f = RDoc::RI::HtmlFormatter.new @output, @width, @indent
+ @markup = RDoc::Markup.new
+ @flow = RDoc::Markup::ToFlow.new
+ @af = RDoc::RI::AttributeFormatter
+ end
+
+ def test_blankline
+ @f.blankline
+
+ assert_equal "<p />\n", @output.string
+ end
+
+ def test_bold_print
+ @f.bold_print 'text'
+
+ assert_equal '<b>text</b>', @output.string
+ end
+
+ def test_break_to_newline
+ @f.break_to_newline
+
+ assert_equal "<br />\n", @output.string
+ end
+
+ def test_display_heading
+ @f.display_heading 'text', 1, ' '
+
+ assert_equal "<h1>text</h1>\n", @output.string
+ end
+
+ def test_display_heading_level_4
+ @f.display_heading 'text', 4, ' '
+
+ assert_equal "<h4>text</h4>\n", @output.string
+ end
+
+ def test_display_heading_level_5
+ @f.display_heading 'text', 5, ' '
+
+ assert_equal "<h4>text</h4>\n", @output.string
+ end
+
+ def test_display_list_bullet
+ list = RDoc::Markup::Flow::LIST.new :BULLET
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+ list << RDoc::Markup::Flow::LI.new(nil, 'd e f')
+
+ @f.display_list list
+
+ expected = <<-EOF.strip
+<ul><li>a b c<p />
+</li><li>d e f<p />
+</li></ul>
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_list_number
+ list = RDoc::Markup::Flow::LIST.new :NUMBER
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
+ list << RDoc::Markup::Flow::LI.new(nil, 'd e f')
+
+ @f.display_list list
+
+ expected = <<-EOF.strip
+<ol><li>a b c<p />
+</li><li>d e f<p />
+</li></ol>
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_list_labeled
+ list = RDoc::Markup::Flow::LIST.new :LABELED
+ list << RDoc::Markup::Flow::LI.new('label', 'a b c')
+ list << RDoc::Markup::Flow::LI.new('label 2', 'd e f')
+
+ @f.display_list list
+
+ expected = <<-EOF.strip
+<dl><dt><b>label</b></dt><dd>a b c<p />
+</dd><dt><b>label 2</b></dt><dd>d e f<p />
+</dd></dl>
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_list_note
+ list = RDoc::Markup::Flow::LIST.new :NOTE
+ list << RDoc::Markup::Flow::LI.new('note:', 'a b c')
+ list << RDoc::Markup::Flow::LI.new('note 2:', 'd e f')
+
+ @f.display_list list
+
+ expected = <<-EOF.strip
+<table><tr valign="top"><td>note:</td><td>a b c<p />
+</td></tr><tr valign="top"><td>note&nbsp;2:</td><td>d e f<p />
+</td></tr></table>
+ EOF
+
+ assert_equal expected, @output.string
+ end
+
+ def test_display_verbatim_flow_item
+ verbatim = RDoc::Markup::Flow::VERB.new '*a* > b &gt; c'
+ @f.display_verbatim_flow_item verbatim
+
+ assert_equal "<pre>*a* &gt; b &amp;gt; c\n</pre>\n", @output.string
+ end
+
+ def test_draw_line
+ @f.draw_line
+
+ assert_equal "<hr />\n", @output.string
+ end
+
+ def test_draw_line_label
+ @f.draw_line 'label'
+
+ assert_equal "<b>label</b><hr />\n", @output.string
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_overstrike_formatter.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_overstrike_formatter.rb
new file mode 100644
index 000000000..38b95414d
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_overstrike_formatter.rb
@@ -0,0 +1,71 @@
+require 'stringio'
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/ri/formatter'
+require 'rdoc/markup/fragments'
+require 'rdoc/markup/to_flow'
+
+class TestRDocRIOverstrikeFormatter < MiniTest::Unit::TestCase
+
+ def setup
+ @output = StringIO.new
+ @width = 78
+ @indent = ' '
+
+ @f = RDoc::RI::OverstrikeFormatter.new @output, @width, @indent
+ @markup = RDoc::Markup.new
+ @flow = RDoc::Markup::ToFlow.new
+
+ @af = RDoc::RI::AttributeFormatter
+ end
+
+ def test_display_verbatim_flow_item_bold
+ verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
+
+ @f.display_verbatim_flow_item verbatim
+
+ assert_equal " *a* b c\n\n", @output.string
+ end
+
+ def test_write_attribute_text_bold
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('b', @af::BOLD)]
+
+ @f.write_attribute_text ' ', line
+
+ assert_equal " b\bb\n", @output.string
+ end
+
+ def test_write_attribute_text_bold_italic
+ attr = @af::BOLD | @af::ITALIC
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('d', attr)]
+
+ @f.write_attribute_text ' ', line
+
+ assert_equal " _\bd\bd\n", @output.string
+ end
+
+ def test_write_attribute_text_code
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('c', @af::CODE)]
+
+ @f.write_attribute_text ' ', line
+
+ assert_equal " _\bc\n", @output.string
+ end
+
+ def test_write_attribute_text_italic
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('a', @af::ITALIC)]
+
+ @f.write_attribute_text ' ', line
+
+ assert_equal " _\ba\n", @output.string
+ end
+
+ def test_bold_print
+ @f.bold_print 'a b c'
+
+ assert_equal "a\ba \b b\bb \b c\bc", @output.string
+ end
+
+end
+
+MiniTest::Unit.autorun
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_task.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_task.rb
new file mode 100644
index 000000000..dd3114fb5
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_task.rb
@@ -0,0 +1,64 @@
+require 'rubygems'
+require 'minitest/autorun'
+require 'rdoc/task'
+
+class TestRDocTask < MiniTest::Unit::TestCase
+
+ def setup
+ Rake::Task.clear
+ end
+
+ def test_tasks_creation
+ RDoc::Task.new
+ assert Rake::Task[:rdoc]
+ assert Rake::Task[:clobber_rdoc]
+ assert Rake::Task[:rerdoc]
+ end
+
+ def test_tasks_creation_with_custom_name_symbol
+ rd = RDoc::Task.new(:rdoc_dev)
+ assert Rake::Task[:rdoc_dev]
+ assert Rake::Task[:clobber_rdoc_dev]
+ assert Rake::Task[:rerdoc_dev]
+ assert_equal :rdoc_dev, rd.name
+ end
+
+ def test_tasks_creation_with_custom_name_string
+ rd = RDoc::Task.new("rdoc_dev")
+ assert Rake::Task[:rdoc_dev]
+ assert Rake::Task[:clobber_rdoc_dev]
+ assert Rake::Task[:rerdoc_dev]
+ assert_equal "rdoc_dev", rd.name
+ end
+
+ def test_tasks_creation_with_custom_name_hash
+ options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
+ rd = RDoc::Task.new(options)
+ assert Rake::Task[:"rdoc"]
+ assert Rake::Task[:"rdoc:clean"]
+ assert Rake::Task[:"rdoc:force"]
+ assert_raises(RuntimeError) { Rake::Task[:clobber_rdoc] }
+ assert_equal options, rd.name
+ end
+
+ def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
+ rd = RDoc::Task.new(:clobber_rdoc => "rdoc:clean")
+ assert Rake::Task[:rdoc]
+ assert Rake::Task[:"rdoc:clean"]
+ assert Rake::Task[:rerdoc]
+ end
+
+ def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
+ assert_raises(ArgumentError) do
+ RDoc::Task.new(:foo => "bar")
+ end
+
+ begin
+ RDoc::Task.new(:foo => "bar")
+ rescue ArgumentError => e
+ assert_match(/foo/, e.message)
+ end
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/test_rdoc_top_level.rb b/vendor/gems/rdoc-2.4.3/test/test_rdoc_top_level.rb
new file mode 100644
index 000000000..3287eacfa
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/test_rdoc_top_level.rb
@@ -0,0 +1,85 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'test/xref_test_case'
+
+class TestRDocTopLevel < XrefTestCase
+
+ def setup
+ super
+
+ @top_level = RDoc::TopLevel.new 'path/top_level.rb'
+ end
+
+ def test_class_all_classes_and_modules
+ assert_equal %w[C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 M1],
+ RDoc::TopLevel.all_classes_and_modules.map { |m| m.full_name }.sort
+ end
+
+ def test_class_classes
+ assert_equal %w[C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4],
+ RDoc::TopLevel.classes.map { |m| m.full_name }.sort
+ end
+
+ def test_class_files
+ assert_equal %w[path/top_level.rb xref_data.rb],
+ RDoc::TopLevel.files.map { |m| m.full_name }.sort
+ end
+
+ def test_class_find_class_named
+ assert_equal @c1, RDoc::TopLevel.find_class_named('C1')
+ end
+
+ def test_class_find_file_named
+ assert_equal @xref_data, RDoc::TopLevel.find_file_named(@file_name)
+ end
+
+ def test_class_find_module_named
+ assert_equal @m1, RDoc::TopLevel.find_module_named('M1')
+ end
+
+ def test_class_modules
+ assert_equal %w[M1],
+ RDoc::TopLevel.modules.map { |m| m.full_name }.sort
+ end
+
+ def test_class_reset
+ RDoc::TopLevel.reset
+
+ assert_empty RDoc::TopLevel.classes
+ assert_empty RDoc::TopLevel.modules
+ assert_empty RDoc::TopLevel.files
+ end
+
+ def test_base_name
+ assert_equal 'top_level.rb', @top_level.base_name
+ end
+
+ def test_find_class_or_module_named
+ assert_equal @c1, @xref_data.find_class_or_module_named('C1')
+ assert_equal @c4, @xref_data.find_class_or_module_named('C4')
+ end
+
+ def test_full_name
+ assert_equal 'path/top_level.rb', @top_level.full_name
+ end
+
+ def test_http_url
+ assert_equal 'prefix/path/top_level_rb.html', @top_level.http_url('prefix')
+ end
+
+ def test_last_modified
+ assert_equal 'Unknown', @top_level.last_modified
+
+ stat = Object.new
+ def stat.mtime() 0 end
+ @top_level.file_stat = stat
+
+ assert_equal '0', @top_level.last_modified
+ end
+
+ def test_name
+ assert_equal 'top_level.rb', @top_level.name
+ end
+
+end
+
diff --git a/vendor/gems/rdoc-2.4.3/test/xref_data.rb b/vendor/gems/rdoc-2.4.3/test/xref_data.rb
new file mode 100644
index 000000000..5d7e42bc2
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/xref_data.rb
@@ -0,0 +1,46 @@
+XREF_DATA = <<-XREF_DATA
+class C1
+
+ attr :attr
+ attr_reader :attr_reader
+ attr_writer :attr_writer
+ attr_accessor :attr_accessor
+
+ CONST = :const
+
+ def self.m
+ end
+
+ def m
+ end
+end
+
+class C2
+ class C3
+ def m
+ end
+
+ class H1
+ def m?
+ end
+ end
+ end
+end
+
+class C3
+ class H1
+ end
+
+ class H2
+ end
+end
+
+class C4
+ class C4
+ end
+end
+
+module M1
+end
+XREF_DATA
+
diff --git a/vendor/gems/rdoc-2.4.3/test/xref_test_case.rb b/vendor/gems/rdoc-2.4.3/test/xref_test_case.rb
new file mode 100644
index 000000000..9c8b4748d
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/test/xref_test_case.rb
@@ -0,0 +1,48 @@
+require 'rubygems'
+require 'minitest/unit'
+require 'rdoc/stats'
+require 'rdoc/options'
+require 'rdoc/code_objects'
+require 'rdoc/parser/ruby'
+require 'test/xref_data'
+
+class XrefTestCase < MiniTest::Unit::TestCase
+
+ def setup
+ RDoc::TopLevel.reset
+ RDoc::AnyMethod.reset
+
+ @file_name = 'xref_data.rb'
+ @xref_data = RDoc::TopLevel.new @file_name
+
+ @options = RDoc::Options.new
+ @options.quiet = true
+
+ stats = RDoc::Stats.new 0
+
+ parser = RDoc::Parser::Ruby.new @xref_data, @file_name, XREF_DATA, @options,
+ stats
+ @top_levels = []
+ @top_levels.push parser.scan
+
+ generator = Object.new
+ def generator.class_dir() nil end
+ def generator.file_dir() nil end
+ rdoc = RDoc::RDoc.new
+ RDoc::RDoc.current = rdoc
+ rdoc.generator = generator
+
+ @c1 = @xref_data.find_module_named 'C1'
+ @c2 = @xref_data.find_module_named 'C2'
+ @c2_c3 = @xref_data.find_module_named 'C2::C3'
+ @c3 = @xref_data.find_module_named 'C3'
+ @c4 = @xref_data.find_module_named 'C4'
+ @c4_c4 = @xref_data.find_module_named 'C4::C4'
+
+ @m1 = @xref_data.find_module_named 'M1'
+ end
+
+end
+
+MiniTest::Unit.autorun
+