Merge remote branch 'henrikh/test-sections'
This commit is contained in:
+44
-2
@@ -17,6 +17,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_details)
|
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)
|
||||||
|
|
||||||
@@ -96,6 +102,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}"
|
||||||
@@ -213,6 +225,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")
|
||||||
@@ -244,6 +262,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>" +
|
||||||
@@ -292,6 +316,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>"
|
||||||
@@ -313,18 +343,30 @@ context "Markup" do
|
|||||||
compare(content, output, 'org')
|
compare(content, output, 'org')
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tex block syntax" do
|
#########################################################################
|
||||||
|
#
|
||||||
|
# TeX
|
||||||
|
#
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
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>"
|
||||||
compare(content, output, 'md')
|
compare(content, output, 'md')
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tex inline syntax" do
|
test "TeX inline syntax" do
|
||||||
content = 'a \( a^2 \) b'
|
content = 'a \( a^2 \) b'
|
||||||
output = "<p>a <script type=\"math/tex\">a^2</script> b</p>"
|
output = "<p>a <script type=\"math/tex\">a^2</script> b</p>"
|
||||||
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