all repos — markup @ ebff9cba0476220be0b992befd495bfd760bf71a

The code we use to render README.your_favorite_markup

test/markup_test.rb (view raw)

  1$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
  2$LOAD_PATH.unshift File.dirname(__FILE__)
  3
  4require 'github/markup'
  5require 'test/unit'
  6require 'helper'
  7
  8class MarkupTest < Test::Unit::TestCase
  9  extend MarkupTestDSL
 10
 11  def test_graceful_fail
 12    content = "* One\n* Two"
 13    text = GitHub::Markup.render('README.imadeitup', content)
 14    assert_equal content, text
 15  end
 16
 17  test 'README.markdown', <<-input, <<-output
 18* One
 19* Two
 20input
 21<ul>
 22<li>One</li>
 23<li>Two</li>
 24</ul>\n
 25output
 26
 27  test 'README.textile', <<-input, <<-output.strip
 28* One
 29* Two
 30input
 31<ul>
 32\t<li>One</li>
 33\t<li>Two</li>
 34</ul>\n
 35output
 36
 37  test 'README.txt', <<-input, <<-output
 38* One
 39* Two
 40input
 41* One
 42* Two
 43output
 44
 45  test 'README.rdoc', <<-input, <<-output
 46* One
 47* Two
 48input
 49<ul>
 50<li>One\n\n</li>
 51<li>Two\n\n</li>
 52</ul>
 53output
 54
 55  test 'README.asciidoc', <<-input, <<-output
 56* One
 57* Two
 58input
 59<div class="ulist"><ul>\r
 60<li>\r
 61<p>\r
 62One\r
 63</p>\r
 64</li>\r
 65<li>\r
 66<p>\r
 67Two\r
 68</p>\r
 69</li>\r
 70</ul></div>\r\n
 71output
 72
 73  test 'README.rst', <<-input, <<-output
 741. Blah blah ``code`` blah
 75
 762. More ``code``, hooray
 77input
 78<div class="document">
 79<ol class="arabic simple">
 80<li>Blah blah <tt class="docutils literal">code</tt> blah</li>
 81<li>More <tt class="docutils literal">code</tt>, hooray</li>
 82</ol>
 83</div>\n
 84output
 85
 86
 87  test 'README.pod', <<-input, <<-output
 88=head1 NAME
 89
 90podsample - A sample pod document
 91
 92=item * This is a bulleted list.
 93
 94=item * Here's another item.
 95input
 96<div name="index">
 97<p><a name="__index__"></a></p>
 98
 99<ul>
100
101\t<li><a href="#name">NAME</a></li>
102</ul>
103
104<hr name="index" />
105</div>
106output
107
108end