Sha256: d9442c37b611d20d31fa2ec4a1bfbc3cd946a0307e16f1a96d0c3c1eca4f5fcc

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

require "test/unit"
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
    assert_equal(
      "\n\\section{A}\nAbe\n\n\\subsection{B}\nBabe\n\n\\subsection{C}\n\n\\section{D}\n\n\\subsection{E}\n\n\\subsubsection{F}", 
      table_of_contents("* [[A]]\n** [[B]]\n** [[C]]\n* D\n** [[E]]\n*** F", { "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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
Pimki-1.4.092 libraries/redcloth_for_tex_test.rb
Pimki-1.5.092 libraries/redcloth_for_tex_test.rb
Pimki-1.6.092 libraries/redcloth_for_tex_test.rb
Pimki-1.7.092 libraries/redcloth_for_tex_test.rb
Pimki-1.8.092 libraries/redcloth_for_tex_test.rb
Pimki-1.8.200 libraries/redcloth_for_tex_test.rb