diff --git a/test/test_markup.rb b/test/test_markup.rb index 0a3e6649..c8c7a3d3 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -17,6 +17,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_details) @@ -96,6 +102,12 @@ context "Markup" do assert_equal "
", page.formatted_data end + ######################################################################### + # + # Images + # + ######################################################################### + test "image with http url" do ['http', 'https'].each do |scheme| name = "Bilbo Baggins #{scheme}" @@ -213,6 +225,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") @@ -244,6 +262,12 @@ context "Markup" do assert_equal %{a Alpha b
}, page.formatted_data end + ######################################################################### + # + # Code + # + ######################################################################### + test "code blocks" do content = "a\n\n```ruby\nx = 1\n```\n\nb" output = "a
\n\n" +
@@ -292,6 +316,12 @@ context "Markup" do
compare(content, output)
end
+ #########################################################################
+ #
+ # Various
+ #
+ #########################################################################
+
test "escaped wiki link" do
content = "a '[[Foo]], b"
output = "a [[Foo]], b
"
@@ -313,18 +343,30 @@ context "Markup" do
compare(content, output, 'org')
end
- test "tex block syntax" do
+ #########################################################################
+ #
+ # TeX
+ #
+ #########################################################################
+
+ test "TeX block syntax" do
content = 'a \[ a^2 \] b'
output = "a b
"
compare(content, output, 'md')
end
- test "tex inline syntax" do
+ test "TeX inline syntax" do
content = 'a \( a^2 \) b'
output = "a b
"
compare(content, output, 'md')
end
+ #########################################################################
+ #
+ # Helpers
+ #
+ #########################################################################
+
def compare(content, output, ext = "md", regexes = [])
index = @wiki.repo.index
index.add("Bilbo-Baggins.#{ext}", content)
@@ -350,4 +392,4 @@ context "Markup" do
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
end
-end
\ No newline at end of file
+end