From d0e834978aef8c997b0419f1ea43533a2a4e6061 Mon Sep 17 00:00:00 2001
From: Jacques Distler
Date: Tue, 11 Sep 2007 12:04:26 -0500
Subject: [PATCH] Fix Broken Tests In preparation for adding new tests, let's
fix the existing ones. 3 Unit tests and one Functional test still fail.
* Two unit tests are bugs in xhtmldiff
* One is a bug in Maruku
* A file upload functional test fails, for reasons that escape me.
---
test/fixtures/webs.yml | 4 +-
test/functional/wiki_controller_test.rb | 49 ++++++++++++++++++++-----
test/unit/page_renderer_test.rb | 42 ++++++++++-----------
test/unit/web_test.rb | 5 ++-
4 files changed, 66 insertions(+), 34 deletions(-)
diff --git a/test/fixtures/webs.yml b/test/fixtures/webs.yml
index 05437295..c847d96f 100644
--- a/test/fixtures/webs.yml
+++ b/test/fixtures/webs.yml
@@ -4,7 +4,7 @@ test_wiki:
updated_at: 2005-08-01
name: wiki1
address: wiki1
- markup: textile
+ markup: markdownMML
instiki:
id: 2
@@ -12,4 +12,4 @@ instiki:
updated_at: 2005-08-01
name: Instiki
address: instiki
- markup: textile
\ No newline at end of file
+ markup: markdownMML
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 8e8590c3..44cfb458 100755
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -151,7 +151,7 @@ class WikiControllerTest < Test::Unit::TestCase
assert_response(:success, bypass_body_parsing = true)
assert_equal 'application/zip', r.headers['Content-Type']
- assert_match /attachment; filename="wiki1-textile-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
+ assert_match /attachment; filename="wiki1-markdownMML-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
r.headers['Content-Disposition']
assert_equal 'PK', r.body[0..1], 'Content is not a zip file'
end
@@ -665,14 +665,45 @@ class WikiControllerTest < Test::Unit::TestCase
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
assert_response(:success)
- assert_equal "\\documentclass[12pt,titlepage]{article}\n\n\\usepackage{amsmath}" +
- "\n\\usepackage{amsfonts}\n\\usepackage{graphicx}\n\\usepackage{ucs}\n" +
- "\\usepackage[utf8x]{inputenc}\n\\usepackage{hyperref}\n\n" +
- "%-------------------------------------------------------------------\n\n" +
- "\\begin{document}\n\n%--------------------------------------------------" +
- "-----------------\n\n\\section*{HomePage}\n\nTeX export only supported with" +
- " the Markdown text filters.\n\n\\end{document}\n",
- r.body
+ assert_equal %q!\documentclass[12pt,titlepage]{article}
+
+\usepackage{amsmath}
+\usepackage{amsfonts}
+\usepackage{amssymb}
+\usepackage{graphicx}
+\usepackage{ucs}
+\usepackage[utf8x]{inputenc}
+\usepackage{hyperref}
+
+%----Macros----------
+\newcommand{\gt}{>}
+\newcommand{\lt}{<}
+\newcommand{\darr}{\downarrow}
+\newcommand{\nearr}{\nearrow}
+\newcommand{\nwarr}{\nwarrow}
+\newcommand{\searr}{\searrow}
+\newcommand{\swarr}{\swarrow}
+\newcommand{\iff}{\Longleftrightarrow}
+\newcommand{\impliedby}{\Leftarrow}
+\newcommand{\map}{\mapsto}
+\newcommand{\embedsin}{\hookrightarrow}
+\newcommand{\implies}{\Rightarrow}
+\newcommand{\qed}{\blacksquare}
+
+%-------------------------------------------------------------------
+
+\begin{document}
+
+%-------------------------------------------------------------------
+
+\section*{HomePage}
+
+HisWay would be MyWay in kinda ThatWay in HisWay though MyWay $\backslash$OverThere --{} see SmartEngine in that SmartEngineGUI
+
+
+
+\end{document}
+!, r.body
end
diff --git a/test/unit/page_renderer_test.rb b/test/unit/page_renderer_test.rb
index 94544d72..7be3c7d1 100644
--- a/test/unit/page_renderer_test.rb
+++ b/test/unit/page_renderer_test.rb
@@ -46,7 +46,7 @@ class PageRendererTest < Test::Unit::TestCase
'would be My Way in kinda ' +
'That Way in ' +
'His Way? ' +
- %{though My Way OverThere—see } +
+ %{though My Way OverThere \xE2\x80\x93 see } +
'Smart Engine in that ' +
'Smart Engine GUI' +
'?
',
@@ -157,21 +157,21 @@ class PageRendererTest < Test::Unit::TestCase
assert_markup_parsed_as(
'should we go ' +
'That Way or This Way?' +
- '
',
+ '',
'_should we go ThatWay or ThisWay _')
end
# wikiwords are invalid as styles, must be in "name: value" form
def test_content_with_wikiword_in_style_tag
assert_markup_parsed_as(
- "That is some Stylish Emphasis
",
+ "That is some Stylish Emphasis
",
'That is some Stylish Emphasis')
end
# validates format of style..
def test_content_with_valid_style_in_style_tag
assert_markup_parsed_as(
- "That is some Stylish Emphasis
",
+ "That is some Stylish Emphasis
",
'That is some Stylish Emphasis')
end
@@ -182,38 +182,38 @@ class PageRendererTest < Test::Unit::TestCase
def test_content_with_pre_blocks
assert_markup_parsed_as(
- 'A class SmartEngine end
would not mark up
CodeBlocks
',
- 'A class SmartEngine end
would not mark up CodeBlocks
')
+ 'A class SmartEngine end
would not mark up
\n\nCodeBlocks
\n\nwould it?
',
+ 'A class SmartEngine end
would not mark up\n\nCodeBlocks
\n\nwould it?')
end
def test_content_with_autolink_in_parentheses
assert_markup_parsed_as(
- 'The W3C body (' +
+ 'The W3C body (' +
'http://www.w3c.org) sets web standards
',
'The W3C body (http://www.w3c.org) sets web standards')
end
def test_content_with_link_in_parentheses
assert_markup_parsed_as(
- "(What is a wiki?)
",
- '("What is a wiki?":http://wiki.org/wiki.cgi?WhatIsWiki)')
+ "(What is a wiki?)
",
+ '([What is a wiki?](http://wiki.org/wiki.cgi?WhatIsWiki))')
end
def test_content_with_image_link
assert_markup_parsed_as(
- "This
is a Textile image link.
",
- 'This !http://hobix.com/sample.jpg! is a Textile image link.')
+ "This
is a Markdown image link.
",
+ 'This ![](http://hobix.com/sample.jpg) is a Markdown image link.')
end
def test_content_with_inlined_img_tag
assert_markup_parsed_as(
- "This
is an inline image link.
",
+ "This
is an inline image link.
",
'This
is an inline image link.')
# currently, upper case HTML elements are not allowed
assert_markup_parsed_as(
- 'This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.
',
- 'This
is an inline image link.')
+ 'This <IMG SRC="http://hobix.com/sample.jpg" alt=""></IMG> is an inline image link.
',
+ 'This
is an inline image link.')
end
def test_nowiki_tag
@@ -244,7 +244,7 @@ class PageRendererTest < Test::Unit::TestCase
'My Way in kinda ' +
'That Way in ' +
'His Way though ' +
- %{My Way OverThere—see } +
+ %{My Way OverThere \xE2\x80\x93 see } +
'Smart Engine in that ' +
'Smart Engine GUI
',
test_renderer(@revision).display_content_for_export
@@ -253,14 +253,14 @@ class PageRendererTest < Test::Unit::TestCase
def test_double_replacing
@revision.content = "VersionHistory\r\n\r\ncry VersionHistory"
assert_equal 'Version History' +
- "?
\n\n\n\tcry " +
+ "?
\n\ncry " +
'Version History?' +
'
',
test_renderer(@revision).display_content
@revision.content = "f\r\nVersionHistory\r\n\r\ncry VersionHistory"
- assert_equal "f
Version History" +
- "?
\n\n\n\tcry " +
+ assert_equal "
f Version History" +
+ "?
\n\ncry " +
"Version History?" +
"
",
test_renderer(@revision).display_content
@@ -321,12 +321,12 @@ class PageRendererTest < Test::Unit::TestCase
def test_list_with_tildas
list_with_tildas = <<-EOL
- * "a":~b
- * c~ d
+* [a](~b)
+* c~ d
EOL
assert_markup_parsed_as(
- "",
+ "",
list_with_tildas)
end
diff --git a/test/unit/web_test.rb b/test/unit/web_test.rb
index 0dc0b9ec..3ef65d68 100644
--- a/test/unit/web_test.rb
+++ b/test/unit/web_test.rb
@@ -1,7 +1,8 @@
-require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
+require File.dirname(__FILE__) + '/../test_helper'
+#require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class WebTest < Test::Unit::TestCase
- fixtures :webs, :pages, :revisions, :system, :wiki_references
+ fixtures :system, :webs, :pages, :revisions, :wiki_references
def setup
@web = webs(:instiki)