Add sections to clean up markup test code

This commit is contained in:
Henrik Hansen
2010-08-29 10:08:08 +02:00
parent 48b143c6ed
commit 8301428974
+43 -1
View File
@@ -21,6 +21,12 @@ context "Markup" do
assert @wiki.pages[0].formatted_data
end
#########################################################################
#
# Links
#
#########################################################################
test "double page links no space" do
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", @commit)
@@ -100,6 +106,12 @@ context "Markup" do
assert_equal "<p>a <a href=\"http://example.com\">http://example.com</a> b</p>", page.formatted_data
end
#########################################################################
#
# Images
#
#########################################################################
test "image with http url" do
['http', 'https'].each do |scheme|
name = "Bilbo Baggins #{scheme}"
@@ -217,6 +229,12 @@ context "Markup" do
relative_image(content, output)
end
#########################################################################
#
# File links
#
#########################################################################
test "file link with absolute path" do
index = @wiki.repo.index
index.add("alpha.jpg", "hi")
@@ -248,6 +266,12 @@ context "Markup" do
assert_equal %{<p>a <a href="http://example.com/alpha.jpg">Alpha</a> b</p>}, page.formatted_data
end
#########################################################################
#
# Code
#
#########################################################################
test "code blocks" do
content = "a\n\n```ruby\nx = 1\n```\n\nb"
output = "<p>a</p>\n\n<div class=\"highlight\"><pre>" +
@@ -296,6 +320,12 @@ context "Markup" do
compare(content, output)
end
#########################################################################
#
# Various
#
#########################################################################
test "escaped wiki link" do
content = "a '[[Foo]], b"
output = "<p>a [[Foo]], b</p>"
@@ -317,6 +347,12 @@ context "Markup" do
compare(content, output, 'org')
end
#########################################################################
#
# TeX
#
#########################################################################
test "tex block syntax" do
content = 'a \[ a^2 \] b'
output = "<p>a <script type=\"math/tex; mode=display\">a^2</script> b</p>"
@@ -329,6 +365,12 @@ context "Markup" do
compare(content, output, 'md')
end
#########################################################################
#
# Helpers
#
#########################################################################
def compare(content, output, ext = "md", regexes = [])
index = @wiki.repo.index
index.add("Bilbo-Baggins.#{ext}", content)
@@ -353,4 +395,4 @@ context "Markup" do
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
end
end
end