diff --git a/test/test_markup.rb b/test/test_markup.rb index 8b3b4579..9744d3d5 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -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 "

a http://example.com b

", 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 %{

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
" +
@@ -296,6 +320,12 @@ context "Markup" do
     compare(content, output)
   end
 
+  #########################################################################
+  #
+  # Various
+  #
+  #########################################################################
+
   test "escaped wiki link" do
     content = "a '[[Foo]], b"
     output = "

a [[Foo]], b

" @@ -317,6 +347,12 @@ context "Markup" do compare(content, output, 'org') end + ######################################################################### + # + # TeX + # + ######################################################################### + test "tex block syntax" do content = 'a \[ a^2 \] b' output = "

a b

" @@ -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 \ No newline at end of file +end