forked from henrik/jekyll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding failing test for UTF-8 pygments issue henrikGH-8
- Loading branch information
Showing
1 changed file
with
35 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,35 +1,51 @@ | |||
require File.dirname(__FILE__) + '/helper' | require File.dirname(__FILE__) + '/helper' | ||
|
|
||
class TestTags < Test::Unit::TestCase | class TestTags < Test::Unit::TestCase | ||
context "tagging" do |
|
||
setup do | def create_post(code) | ||
@content = <<CONTENT | stub(Jekyll).configuration do | ||
Jekyll::DEFAULTS.merge({'pygments' => true}) | |||
end | |||
site = Site.new(Jekyll.configuration) | |||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } } | |||
|
|||
content = <<CONTENT | |||
--- | --- | ||
layout: post | |||
title: This is a test | title: This is a test | ||
--- | --- | ||
This document results in a markdown error with maruku | |||
{% highlight ruby %} | This document results in a markdown error with maruku | ||
puts "hi" | |||
puts "bye" | {% highlight text %} | ||
#{code} | |||
{% endhighlight %} | {% endhighlight %} | ||
CONTENT | CONTENT | ||
|
|||
@result = Liquid::Template.parse(content).render({}, info) | |||
@result = site.markdown(@result) | |||
end | |||
|
|||
context "post content has highlight tag" do | |||
setup do | |||
create_post("test") | |||
end | |||
|
|||
should "not cause a markdown error" do | |||
assert_no_match /markdown\-html\-error/, @result | |||
end | |||
|
|||
should "render markdown with pygments line handling" do | |||
assert_match %{<pre>test\n</pre>}, @result | |||
end | |||
end | |||
|
|||
context "post content has highlight tag with UTF character" do | |||
setup do | |||
create_post("Æ") | |||
end | end | ||
|
|
||
should "render markdown with pygments line handling" do | should "render markdown with pygments line handling" do | ||
stub(Jekyll).configuration do | assert_match %{<pre>Æ\n</pre>}, @result | ||
Jekyll::DEFAULTS.merge({'pygments' => true}) | |||
end | |||
site = Site.new(Jekyll.configuration) | |||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } } | |||
|
|||
result = Liquid::Template.parse(@content).render({}, info) | |||
result = site.markdown(result) | |||
assert_no_match(/markdown\-html\-error/,result) | |||
end | end | ||
end | end | ||
end | end |