Add sections to clean up markup test code
This commit is contained in:
@@ -21,6 +21,12 @@ context "Markup" do
|
|||||||
assert @wiki.pages[0].formatted_data
|
assert @wiki.pages[0].formatted_data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# Links
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "double page links no space" do
|
test "double page links no space" do
|
||||||
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", @commit)
|
@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
|
assert_equal "<p>a <a href=\"http://example.com\">http://example.com</a> b</p>", page.formatted_data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# Images
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "image with http url" do
|
test "image with http url" do
|
||||||
['http', 'https'].each do |scheme|
|
['http', 'https'].each do |scheme|
|
||||||
name = "Bilbo Baggins #{scheme}"
|
name = "Bilbo Baggins #{scheme}"
|
||||||
@@ -217,6 +229,12 @@ context "Markup" do
|
|||||||
relative_image(content, output)
|
relative_image(content, output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# File links
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "file link with absolute path" do
|
test "file link with absolute path" do
|
||||||
index = @wiki.repo.index
|
index = @wiki.repo.index
|
||||||
index.add("alpha.jpg", "hi")
|
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
|
assert_equal %{<p>a <a href="http://example.com/alpha.jpg">Alpha</a> b</p>}, page.formatted_data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# Code
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "code blocks" do
|
test "code blocks" do
|
||||||
content = "a\n\n```ruby\nx = 1\n```\n\nb"
|
content = "a\n\n```ruby\nx = 1\n```\n\nb"
|
||||||
output = "<p>a</p>\n\n<div class=\"highlight\"><pre>" +
|
output = "<p>a</p>\n\n<div class=\"highlight\"><pre>" +
|
||||||
@@ -296,6 +320,12 @@ context "Markup" do
|
|||||||
compare(content, output)
|
compare(content, output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# Various
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "escaped wiki link" do
|
test "escaped wiki link" do
|
||||||
content = "a '[[Foo]], b"
|
content = "a '[[Foo]], b"
|
||||||
output = "<p>a [[Foo]], b</p>"
|
output = "<p>a [[Foo]], b</p>"
|
||||||
@@ -317,6 +347,12 @@ context "Markup" do
|
|||||||
compare(content, output, 'org')
|
compare(content, output, 'org')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# TeX
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
test "tex block syntax" do
|
test "tex block syntax" do
|
||||||
content = 'a \[ a^2 \] b'
|
content = 'a \[ a^2 \] b'
|
||||||
output = "<p>a <script type=\"math/tex; mode=display\">a^2</script> b</p>"
|
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')
|
compare(content, output, 'md')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
#
|
||||||
|
# Helpers
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
def compare(content, output, ext = "md", regexes = [])
|
def compare(content, output, ext = "md", regexes = [])
|
||||||
index = @wiki.repo.index
|
index = @wiki.repo.index
|
||||||
index.add("Bilbo-Baggins.#{ext}", content)
|
index.add("Bilbo-Baggins.#{ext}", content)
|
||||||
|
|||||||
Reference in New Issue
Block a user