Got rid of redcloth_for_tex.
Fixed almost all the busted tests.
This commit is contained in:
Jacques Distler 2007-06-13 01:56:44 -05:00
parent 2da672ec5b
commit 3ca33e52b5
15 changed files with 321 additions and 1317 deletions

View file

@ -46,7 +46,7 @@ class PageRendererTest < Test::Unit::TestCase
'would be <a class="existingWikiWord" href="../show/MyWay">My Way</a> in kinda ' +
'<a class="existingWikiWord" href="../show/ThatWay">That Way</a> in ' +
'<span class="newWikiWord">His Way<a href="../show/HisWay">?</a></span> ' +
"though <a class=\"existingWikiWord\" href=\"../show/MyWay\">My Way</a> OverThere\u8212see " +
%{though <a class="existingWikiWord" href="../show/MyWay">My Way</a> OverThere—see } +
'<a class="existingWikiWord" href="../show/SmartEngine">Smart Engine</a> in that ' +
'<span class="newWikiWord">Smart Engine GUI' +
'<a href="../show/SmartEngineGUI">?</a></span></p>',
@ -61,6 +61,11 @@ class PageRendererTest < Test::Unit::TestCase
%{Smart Engine GUI<a href="../show/SmartEngineGUI">?</a></span></p>},
"My Headline\n===========\n\nthat SmartEngineGUI")
assert_markup_parsed_as(
%{<h1>My Headline</h1>\n\n<p>that <span class="newWikiWord">} +
%{Smart Engine GUI<a href="../show/SmartEngineGUI">?</a></span></p>},
"#My Headline#\n\nthat SmartEngineGUI")
code_block = [
'This is a code block:',
'',
@ -239,7 +244,7 @@ class PageRendererTest < Test::Unit::TestCase
'<a class="existingWikiWord" href="MyWay.html">My Way</a> in kinda ' +
'<a class="existingWikiWord" href="ThatWay.html">That Way</a> in ' +
'<span class="newWikiWord">His Way</span> though ' +
"<a class=\"existingWikiWord\" href=\"MyWay.html\">My Way</a> OverThere\u8212see " +
%{<a class="existingWikiWord" href="MyWay.html">My Way</a> OverThere—see } +
'<a class="existingWikiWord" href="SmartEngine.html">Smart Engine</a> in that ' +
'<span class="newWikiWord">Smart Engine GUI</span></p>',
test_renderer(@revision).display_content_for_export
@ -274,8 +279,8 @@ class PageRendererTest < Test::Unit::TestCase
Revision.create(:page => @page, :content => 'What a red and lovely morning today',
:author => Author.new('DavidHeinemeierHansson'), :revised_at => Time.now)
assert_equal "<p>What a <del class=\"diffmod\">blue</del><ins class=\"diffmod\">red" +
"</ins> and lovely morning<ins class=\"diffins\"> today</ins></p>", test_renderer(@page.revisions.last).display_diff
assert_equal "<p><span> What a<del class='diffmod'> blue</del><ins class='diffmod'> red" +
"</ins> and lovely morning<ins class='diffins'> today</ins></span></p>", test_renderer(@page.revisions.last).display_diff
end
def test_link_to_file

View file

@ -1,69 +0,0 @@
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'
require 'redcloth_for_tex'
class RedClothForTexTest < Test::Unit::TestCase
def test_basics
assert_equal '{\bf First Page}', RedClothForTex.new("*First Page*").to_tex
assert_equal '{\em First Page}', RedClothForTex.new("_First Page_").to_tex
assert_equal "\\begin{itemize}\n\t\\item A\n\t\t\\item B\n\t\t\\item C\n\t\\end{itemize}", RedClothForTex.new("* A\n* B\n* C").to_tex
end
def test_blocks
assert_equal '\section*{hello}', RedClothForTex.new("h1. hello").to_tex
assert_equal '\subsection*{hello}', RedClothForTex.new("h2. hello").to_tex
end
def test_table_of_contents
source = <<EOL
* [[A]]
** [[B]]
** [[C]]
* D
** [[E]]
*** F
EOL
expected_result = <<EOL
\\pagebreak
\\section{A}
Abe
\\subsection{B}
Babe
\\subsection{C}
\\pagebreak
\\section{D}
\\subsection{E}
\\subsubsection{F}
EOL
expected_result.chop!
assert_equal(expected_result, table_of_contents(source, 'A' => 'Abe', 'B' => 'Babe'))
end
def test_entities
assert_equal "Beck \\& Fowler are 100\\% cool", RedClothForTex.new("Beck & Fowler are 100% cool").to_tex
end
def test_bracket_links
assert_equal "such a Horrible Day, but I won't be Made Useless", RedClothForTex.new("such a [[Horrible Day]], but I won't be [[Made Useless]]").to_tex
end
def test_footnotes_on_abbreviations
assert_equal(
"such a Horrible Day\\footnote{1}, but I won't be Made Useless",
RedClothForTex.new("such a [[Horrible Day]][1], but I won't be [[Made Useless]]").to_tex
)
end
def test_subsection_depth
assert_equal "\\subsubsection*{Hello}", RedClothForTex.new("h4. Hello").to_tex
end
end