Adding failing test for RDiscount parsing issue with highlight tags.

This commit is contained in:
Nick Quaranto 2009-04-27 08:21:45 -04:00
parent bad2d172ec
commit e0477e32cc
1 changed files with 50 additions and 7 deletions

View File

@ -2,13 +2,18 @@ require File.dirname(__FILE__) + '/helper'
class TestTags < Test::Unit::TestCase class TestTags < Test::Unit::TestCase
def create_post(code) def create_post(content, override = {})
stub(Jekyll).configuration do stub(Jekyll).configuration do
Jekyll::DEFAULTS.merge({'pygments' => true}) Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
end end
site = Site.new(Jekyll.configuration) site = Site.new(Jekyll.configuration)
info = { :filters => [Jekyll::Filters], :registers => { :site => site } } info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
@result = Liquid::Template.parse(content).render({}, info)
@result = site.markdown(@result)
end
def fill_post(code, override = {})
content = <<CONTENT content = <<CONTENT
--- ---
title: This is a test title: This is a test
@ -20,14 +25,12 @@ This document results in a markdown error with maruku
#{code} #{code}
{% endhighlight %} {% endhighlight %}
CONTENT CONTENT
create_post(content, override)
@result = Liquid::Template.parse(content).render({}, info)
@result = site.markdown(@result)
end end
context "post content has highlight tag" do context "post content has highlight tag" do
setup do setup do
create_post("test") fill_post("test")
end end
should "not cause a markdown error" do should "not cause a markdown error" do
@ -41,11 +44,51 @@ CONTENT
context "post content has highlight tag with UTF character" do context "post content has highlight tag with UTF character" do
setup do setup do
create_post("Æ") fill_post("Æ")
end end
should "render markdown with pygments line handling" do should "render markdown with pygments line handling" do
assert_match %{<pre>Æ\n</pre>}, @result assert_match %{<pre>Æ\n</pre>}, @result
end end
end end
context "simple post with markdown and pre tags" do
setup do
@content = <<CONTENT
---
title: Maruku vs. RDiscount
---
_FIGHT!_
{% highlight ruby %}
puts "3..2..1.."
{% endhighlight %}
*FINISH HIM*
CONTENT
end
context "using Maruku" do
setup do
create_post(@content)
end
should "parse correctly" do
assert_match %{<em>FIGHT!</em>}, @result
assert_match %{<em>FINISH HIM</em>}, @result
end
end
context "using RDiscount" do
setup do
create_post(@content, 'markdown' => 'rdiscount')
end
should "parse correctly" do
assert_match %{<em>FIGHT!</em>}, @result
assert_match %{<em>FINISH HIM</em>}, @result
end
end
end
end end