summaryrefslogtreecommitdiff
path: root/trunk/test/rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/test/rdoc')
-rw-r--r--trunk/test/rdoc/test_rdoc_info_formatting.rb175
-rw-r--r--trunk/test/rdoc/test_rdoc_info_sections.rb136
-rw-r--r--trunk/test/rdoc/test_rdoc_markup.rb613
-rw-r--r--trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb224
-rw-r--r--trunk/test/rdoc/test_rdoc_markup_to_html.rb30
-rw-r--r--trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb18
-rw-r--r--trunk/test/rdoc/test_rdoc_parser_c.rb258
-rw-r--r--trunk/test/rdoc/test_rdoc_parser_ruby.rb539
-rw-r--r--trunk/test/rdoc/test_rdoc_ri_attribute_formatter.rb42
-rw-r--r--trunk/test/rdoc/test_rdoc_ri_default_display.rb296
-rw-r--r--trunk/test/rdoc/test_rdoc_ri_driver.rb92
-rw-r--r--trunk/test/rdoc/test_rdoc_ri_formatter.rb318
-rw-r--r--trunk/test/rdoc/test_rdoc_ri_overstrike_formatter.rb69
13 files changed, 0 insertions, 2810 deletions
diff --git a/trunk/test/rdoc/test_rdoc_info_formatting.rb b/trunk/test/rdoc/test_rdoc_info_formatting.rb
deleted file mode 100644
index 6c024f7454..0000000000
--- a/trunk/test/rdoc/test_rdoc_info_formatting.rb
+++ /dev/null
@@ -1,175 +0,0 @@
-require 'fileutils'
-require 'tmpdir'
-require 'test/unit'
-
-require 'rdoc/generator/texinfo'
-
-# From chapter 18 of the Pickaxe 3rd ed. and the TexInfo manual.
-class TestRdocInfoFormatting < Test::Unit::TestCase
- def setup
- @output_dir = File.join Dir.tmpdir, "test_rdoc_info_formatting_#{$$}"
- @output_file = File.join @output_dir, 'rdoc.texinfo'
-
- RDoc::RDoc.new.document(['--fmt=texinfo', '--quiet',
- File.expand_path(__FILE__),
- "--op=#{@output_dir}"])
- @text = File.read @output_file
-
- # File.open('rdoc.texinfo', 'w') { |f| f.puts @text }
- end
-
- def teardown
- FileUtils.rm_rf @output_dir
- end
-
- # Make sure tags like *this* do not make HTML
- def test_descriptions_are_not_html
- assert_no_match Regexp.new("\<b\>this\<\/b\>"), @text, "We had some HTML; icky!"
- end
-
- # Ensure we get a reasonable amount
- #
- # of space in between paragraphs.
- def test_paragraphs_are_spaced
- assert_match(/amount\n\n\nof space/, @text)
- end
-
- # @ and {} should be at-sign-prefixed
- def test_escaping
- assert_match(/@@ and @\{@\} should be at-sign-prefixed/)
- end
-
- # This tests that *bold* and <b>bold me</b> become @strong{bolded}
- def test_bold
- # Seems like a limitation of the Info format: @strong{bold}
- # becomes *bold* when read in Info or M-x info. highly lame!
- assert_match(/@strong\{bold\}/)
- assert_match(/@strong\{bold me\}/)
- end
-
- # Test that _italics_ and <em>italicize me</em> becomes @emph{italicized}
- def test_italics
- assert_match(/@emph\{italics\}/)
- assert_match(/@emph\{italicize me\}/)
- end
-
- # And that typewriter +text+ and <tt>typewriter me</tt> becomes @code{typewriter}
- def test_tt
- assert_match(/@code\{text\}/)
- assert_match(/@code\{typewriter me\}/)
- end
-
- # Check that
- # anything indented is
- # verbatim @verb{|foo bar baz|}
- def test_literal_code
- assert_match("@verb{| anything indented is
- verbatim @@verb@{|foo bar baz|@}
-|}")
- end
-
- # = Huge heading should be a @majorheading
- # == There is also @chapheading
- # === Everything deeper becomes a regular @heading
- # ====== Regardless of its nesting level
- def test_headings
- assert_match(/@majorheading\{Huge heading should be a @@majorheading\}/)
- assert_match(/@chapheading\{There is also @@chapheading\}/)
- assert_match(/@heading\{Everything deeper becomes a regular @@heading\}/)
- assert_match(/@heading\{Regardless of its nesting level\}/)
- end
-
- # * list item
- # * list item2
- #
- # with a paragraph in between
- #
- # - hyphen lists
- # - are also allowed
- # and items may flow over lines
- def test_bullet_lists
- assert_match("@itemize @bullet
-@item
-list item
-@item
-list item2
-@end itemize")
- assert_match("@itemize @bullet
-@item
-hyphen lists
-@item
-are also allowed and items may flow over lines
-@end itemize")
- end
-
- # 2. numbered lists
- # 8. are made by
- # 9. a digit followed by a period
- def test_numbered_lists
- end
-
- # a. alpha lists
- # b. should be parsed too
- def test_alpha_lists
- end
-
- # [cat] small domestic animal
- # [+cat+] command to copy standard input
- # to standard output
- def test_labelled_lists
- end
-
- # * First item.
- # * Inner item.
- # * Second inner item.
- # * Second outer item.
- def test_nested_lists
- assert_match("@itemize @bullet
-@item
-First item.
-@itemize @bullet
-@item
-Inner item.
-@item
-Second inner item.
-@end itemize
-@item
-Second outer item.
-@end itemize")
- end
-
- def test_internal_hyperlinks
- # be sure to test multi-word hyperlinks as well.
- end
-
- def test_hyperlink_targets
- end
-
- def test_web_links
- # An example of the two-argument form: The official
- # @uref{ftp://ftp.gnu.org/gnu, GNU ftp site} holds programs and texts.
-
- # produces:
- # The official GNU ftp site (ftp://ftp.gnu.org/gnu)
- # holds programs and texts.
- # and the HTML output is this:
- # The official <a href="ftp://ftp.gnu.org/gnu">GNU ftp site</a>
- # holds programs and texts.
- end
-
- # three or more hyphens
- # ----
- # should produce a horizontal rule
- def test_horizontal_rule
- # gah; not sure texinfo supports horizontal rules
- end
-
- private
-
- # We don't want the whole string inspected if we pass our own
- # message in.
- def assert_match(regex, string = @text,
- message = "Didn't find #{regex.inspect} in #{string}.")
- assert string[regex] #, message
- end
-end
diff --git a/trunk/test/rdoc/test_rdoc_info_sections.rb b/trunk/test/rdoc/test_rdoc_info_sections.rb
deleted file mode 100644
index cceba186c1..0000000000
--- a/trunk/test/rdoc/test_rdoc_info_sections.rb
+++ /dev/null
@@ -1,136 +0,0 @@
-require 'fileutils'
-require 'tempfile'
-require 'test/unit'
-require 'tmpdir'
-
-require 'rdoc/generator/texinfo'
-
-# give us access to check this stuff before it's rendered
-class RDoc::Generator::Texinfo; attr_reader :files, :classes; end
-class RDoc::RDoc; attr_reader :options; attr_reader :gen; end
-
-class TestRdocInfoSections < Test::Unit::TestCase
-
- def setup
- @output_dir = File.join Dir.tmpdir, "test_rdoc_info_sections_#{$$}"
- @output_file = File.join @output_dir, 'rdoc.texinfo'
-
- @input_file = Tempfile.new 'my_file.rb'
-
- open @input_file.path, 'w' do |io|
- io.write TEST_DOC
- end
-
- RDoc::Parser.alias_extension '.rb', File.extname(@input_file.path)
-
- @rdoc = RDoc::RDoc.new
- @rdoc.document(['--fmt=texinfo', '--quiet', @input_file.path,
- "--op=#{@output_dir}"])
-
- @text = File.read @output_file
- end
-
- def teardown
- @input_file.close
- FileUtils.rm_rf @output_dir
- end
-
- def test_output_exists
- assert ! @text.empty?
- end
-
- def test_each_class_has_a_chapter
- assert_section "Class MyClass", '@chapter'
- end
-
- def test_class_descriptions_are_given
- assert_match(/Documentation for my class/, @text.gsub("\n", ' '))
- end
-
- def test_included_modules_are_given
- assert_match(/Includes.* MyModule/m, @text)
- end
-
- def test_class_methods_are_given
- assert_match(/my_class_method\(my_first_argument\)/, @text)
- end
-
- def test_classes_instance_methods_are_given
- assert_section 'Class MyClass#my_method'
- assert_match(/my_method\(my_first_argument\)/, @text)
- end
-
- def test_each_module_has_a_chapter
- assert_section 'MyModule', '@chapter'
- end
-
- def test_methods_are_shown_only_once
- methods = @rdoc.gen.classes.map do |c|
- c.methods.map do |m|
- c.name + '#' + m.name
- end
- end.flatten
-
- assert_equal methods, methods.uniq
- end
-
-# if system "makeinfo --version > /dev/null"
-# def test_compiles_to_info
-# makeinfo_output = `cd #{@output_dir} && makeinfo rdoc.texinfo`
-# assert(File.exist?(File.join(@output_dir, 'rdoc.info')),
-# "Info file was not compiled: #{makeinfo_output}")
-# end
-# end
-
-# def test_constants_are_documented_somehow
-# assert_section 'DEFAULT_FILENAME' # what kind of section?
-# assert_section 'DEFAULT_INFO_FILENAME'
-# end
-
-# def test_oh_yeah_dont_forget_files
-# end
-
- def assert_section(name, command = '@section')
- assert_match Regexp.new("^#{command}.*#{Regexp.escape name}"), @text, "Could not find a #{command} #{name}"
- end
-
- TEST_DOC = <<-DOC
-##
-# Documentation for my module
-
-module MyModule
-
- ##
- # Documentation for my included method
-
- def my_included_method() end
-
-end
-
-##
-# Documentation for my class
-
-class MyClass
-
- include MyModule
-
- ##
- # Documentation for my constant
-
- MY_CONSTANT = 'my value'
-
- ##
- # Documentation for my class method
-
- def self.my_class_method(my_first_argument) end
-
- ##
- # Documentation for my method
-
- def my_method(my_first_argument) end
-
-end
-
- DOC
-
-end
diff --git a/trunk/test/rdoc/test_rdoc_markup.rb b/trunk/test/rdoc/test_rdoc_markup.rb
deleted file mode 100644
index d88743858a..0000000000
--- a/trunk/test/rdoc/test_rdoc_markup.rb
+++ /dev/null
@@ -1,613 +0,0 @@
-require 'test/unit'
-require 'rdoc/markup'
-require 'rdoc/markup/to_test'
-
-class TestRDocMarkup < Test::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)
-
- if block != expected
- 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_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
-
diff --git a/trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb b/trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb
deleted file mode 100644
index 8ba9d7440a..0000000000
--- a/trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb
+++ /dev/null
@@ -1,224 +0,0 @@
-require "test/unit"
-require "rdoc/markup/inline"
-
-class TestRDocMarkupAttributeManager < Test::Unit::TestCase
-
- def setup
- @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 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_raise 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_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
- # class names, variable names, file names, or instance variables
- @am.add_special(/(
- \b([A-Z]\w+(::\w+)*)
- | \#\w+[!?=]?
- | \b\w+([_\/\.]+\w+)+[!?=]?
- )/x,
- :CROSSREF)
-
- assert_equal(["cat"], @am.flow("cat"))
-
- assert_equal(["cat ", crossref("#fred"), " dog"].flatten,
- @am.flow("cat #fred dog"))
-
- assert_equal([crossref("#fred"), " dog"].flatten,
- @am.flow("#fred dog"))
-
- assert_equal(["cat ", crossref("#fred")].flatten, @am.flow("cat #fred"))
- end
-
-end
-
diff --git a/trunk/test/rdoc/test_rdoc_markup_to_html.rb b/trunk/test/rdoc/test_rdoc_markup_to_html.rb
deleted file mode 100644
index 463228cc4a..0000000000
--- a/trunk/test/rdoc/test_rdoc_markup_to_html.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'test/unit'
-require 'rdoc/markup'
-require 'rdoc/markup/to_html'
-
-class TestRdocMarkupToHtml < Test::Unit::TestCase
-
- def setup
- @am = RDoc::Markup::AttributeManager.new
- @th = RDoc::Markup::ToHtml.new
- end
-
- def test_tt_formatting
- assert_equal "<p>\n<tt>--</tt> &#8212; <tt>(c)</tt> &#169;\n</p>\n",
- util_format("<tt>--</tt> -- <tt>(c)</tt> (c)")
- assert_equal "<p>\n<b>&#8212;</b>\n</p>\n", util_format("<b>--</b>")
- 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
diff --git a/trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb
deleted file mode 100644
index ab4c3e7e9c..0000000000
--- a/trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'test/unit'
-require 'rdoc/generator'
-require 'rdoc/markup/to_html_crossref'
-
-class TestRdocMarkupToHtmlCrossref < Test::Unit::TestCase
-
- def setup
- @xref = RDoc::Markup::ToHtmlCrossref.new 'from_path', nil, nil
- end
-
- def test_handle_special_CROSSREF_no_underscore
- out = @xref.convert 'foo'
-
- assert_equal "<p>\nfoo\n</p>\n", out
- end
-
-end
-
diff --git a/trunk/test/rdoc/test_rdoc_parser_c.rb b/trunk/test/rdoc/test_rdoc_parser_c.rb
deleted file mode 100644
index fd750070d8..0000000000
--- a/trunk/test/rdoc/test_rdoc_parser_c.rb
+++ /dev/null
@@ -1,258 +0,0 @@
-require 'stringio'
-require 'tempfile'
-require 'test/unit'
-require 'rdoc/options'
-require 'rdoc/parser/c'
-
-class RDoc::Parser::C
- attr_accessor :classes
-
- public :do_classes, :do_constants
-end
-
-class TestRdocParserC < Test::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_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 ", 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 util_get_class(content, name)
- parser = util_parser content
- parser.do_classes
- parser.classes[name]
- end
-
- def util_parser(content)
- RDoc::Parser::C.new @top_level, @fn, content, @options, @stats
- end
-
-end
-
diff --git a/trunk/test/rdoc/test_rdoc_parser_ruby.rb b/trunk/test/rdoc/test_rdoc_parser_ruby.rb
deleted file mode 100644
index 77d8bd24fc..0000000000
--- a/trunk/test/rdoc/test_rdoc_parser_ruby.rb
+++ /dev/null
@@ -1,539 +0,0 @@
-require 'stringio'
-require 'tempfile'
-require 'test/unit'
-
-require 'rdoc/options'
-require 'rdoc/parser/ruby'
-require 'rdoc/stats'
-
-class TestRdocParserRuby < Test::Unit::TestCase
-
- def setup
- @tempfile = Tempfile.new self.class.name
- @filename = @tempfile.path
-
- util_toplevel
- @options = RDoc::Options.new
- @options.quiet = true
- @stats = RDoc::Stats.new 0
- end
-
- def teardown
- @tempfile.close
- 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_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_comment
- content = <<-EOF
-class Foo
- ##
- # :method: my_method
- # my method comment
-
-end
- EOF
- 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.file_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.file_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_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.file_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_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, ''
-
- foo2 = @top_level.classes.first.method_list.last
- assert_equal 'foo2', foo2.name
- assert_equal 'foo', foo2.is_alias_for.name
- 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_extra_accessors
- @options.extra_accessors = /^my_accessor$/
-
- content = "class Foo; my_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 '?', 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_toplevel
- RDoc::TopLevel.reset
- @top_level = RDoc::TopLevel.new @filename
- end
-
-end
-
diff --git a/trunk/test/rdoc/test_rdoc_ri_attribute_formatter.rb b/trunk/test/rdoc/test_rdoc_ri_attribute_formatter.rb
deleted file mode 100644
index d61a6f5cbc..0000000000
--- a/trunk/test/rdoc/test_rdoc_ri_attribute_formatter.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'stringio'
-require 'test/unit'
-require 'rdoc/ri/formatter'
-
-class TestRDocRIAttributeFormatter < Test::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
-
diff --git a/trunk/test/rdoc/test_rdoc_ri_default_display.rb b/trunk/test/rdoc/test_rdoc_ri_default_display.rb
deleted file mode 100644
index 97fa6c94ae..0000000000
--- a/trunk/test/rdoc/test_rdoc_ri_default_display.rb
+++ /dev/null
@@ -1,296 +0,0 @@
-require 'stringio'
-require 'test/unit'
-require 'rdoc/ri/formatter'
-require 'rdoc/ri/display'
-require 'rdoc/ri/driver'
-
-class TestRdocRiDefaultDisplay < Test::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
- ri_reader = nil
- 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' => '"value"',
- 'comment' => [RDoc::Markup::Flow::P.new('CONSTANT value')] },
- { 'name' => 'CONSTANT_NOCOMMENT', 'value' => '"value"',
- 'comment' => nil },
- ],
- 'display_name' => 'Class',
- 'full_name' => 'SomeClass',
- 'includes' => [],
- 'instance_methods' => [
- { 'name' => 'instance_method' },
- ],
- 'instance_method_extensions' => [
- { 'name' => 'instance_method_extension' },
- ],
- 'superclass_string' => 'Object'
-
- @dd.display_class_info klass, ri_reader
-
- expected = <<-EOF
----------------------------------------------------- Class: SomeClass < Object
- SomeClass comment
-
-------------------------------------------------------------------------------
-
-
-Constants:
-----------
-
- CONSTANT:
- CONSTANT value
-
- CONSTANT_NOCOMMENT
-
-
-Class methods:
---------------
-
- class_method
-
-
-Class method extensions:
-------------------------
-
- class_method_extension
-
-
-Instance methods:
------------------
-
- instance_method
-
-
-Instance method extensions:
----------------------------
-
- instance_method_extension
-
-
-Attributes:
------------
-
- attribute (RW):
- attribute comment
-
- attribute_no_comment (RW)
- 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| ...}
-
- Extension 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::Hash.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)
-------------------------------------------------------------------------------
- [no description]
- EOF
-
- assert_equal expected, @output.string
- end
-
- def test_display_method_list
- methods = [
- RDoc::RI::Driver::Hash.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::Hash.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| ...}
-
- Extension 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)
-
- Extension 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| ...}
-
- Extension 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::Hash.convert hash
- end
-
-end
-
diff --git a/trunk/test/rdoc/test_rdoc_ri_driver.rb b/trunk/test/rdoc/test_rdoc_ri_driver.rb
deleted file mode 100644
index cddd4e60d1..0000000000
--- a/trunk/test/rdoc/test_rdoc_ri_driver.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-require 'test/unit'
-require 'tmpdir'
-require 'rdoc/ri/driver'
-
-class TestRDocRIDriver < Test::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
- @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
-
diff --git a/trunk/test/rdoc/test_rdoc_ri_formatter.rb b/trunk/test/rdoc/test_rdoc_ri_formatter.rb
deleted file mode 100644
index ed2ccba22d..0000000000
--- a/trunk/test/rdoc/test_rdoc_ri_formatter.rb
+++ /dev/null
@@ -1,318 +0,0 @@
-require 'stringio'
-require 'test/unit'
-require 'rdoc/ri/formatter'
-require 'rdoc/markup/to_flow'
-
-class TestRDocRIFormatter < Test::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_raise 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_raise 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\n", @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
-
diff --git a/trunk/test/rdoc/test_rdoc_ri_overstrike_formatter.rb b/trunk/test/rdoc/test_rdoc_ri_overstrike_formatter.rb
deleted file mode 100644
index 050e92a4fe..0000000000
--- a/trunk/test/rdoc/test_rdoc_ri_overstrike_formatter.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'stringio'
-require 'test/unit'
-require 'rdoc/ri/formatter'
-require 'rdoc/markup/fragments'
-require 'rdoc/markup/to_flow'
-
-class TestRDocRIOverstrikeFormatter < Test::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
-