diff --git a/test/unit/revision_test.rb b/test/unit/revision_test.rb index d46f6b55..fb21b471 100755 --- a/test/unit/revision_test.rb +++ b/test/unit/revision_test.rb @@ -24,94 +24,52 @@ class RevisionTest < Test::Unit::TestCase @web.markup = :textile - @revision = Revision.new( - @page, - 1, - "HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \\OverThere -- see SmartEngine in that SmartEngineGUI", - Time.local(2004, 4, 4, 16, 50), - "DavidHeinemeierHansson" - ) + @revision = Revision.new(@page, 1, + 'HisWay would be MyWay in kinda ThatWay in HisWay though MyWay \\OverThere -- ' + + 'see SmartEngine in that SmartEngineGUI', + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') - @revision_with_auto_links = Revision.new( - @page, - 1, + @revision_with_auto_links = Revision.new(@page, 1, "http://www.loudthinking.com/ points to ThatWay from david@loudthinking.com", - Time.local(2004, 4, 4, 16, 50), - "DavidHeinemeierHansson" - ) + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') - @revision_with_aliased_links = Revision.new( - @page, - 1, - "Would a [[SmartEngine|clever motor]] go by any other name?", - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + @revision_with_aliased_links = Revision.new(@page, 1, + 'Would a [[SmartEngine|clever motor]] go by any other name?', + Time.local(2004, 4, 4, 16, 50), 'MarkReid') - @revision_with_wiki_word_in_em = Revision.new( - @page, - 1, - "_should we go ThatWay or ThisWay _", - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + @revision_with_wiki_word_in_em = Revision.new(@page, 1, '_should we go ThatWay or ThisWay _', + Time.local(2004, 4, 4, 16, 50), 'MarkReid') - @revision_with_pre_blocks = Revision.new( - @page, - 1, - "A class SmartEngine end would not mark up
CodeBlocks
", - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + @revision_with_pre_blocks = Revision.new(@page, 1, + 'A class SmartEngine end would not mark up
CodeBlocks
', + Time.local(2004, 4, 4, 16, 50), 'MarkReid') - @revision_with_wikiword_in_tag = Revision.new( - @page, - 1, - "That is some Stylish Emphasis", - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + @revision_with_wikiword_in_tag = Revision.new(@page, 1, + 'That is some Stylish Emphasis', + Time.local(2004, 4, 4, 16, 50), 'MarkReid') @revision_with_autolink_in_parentheses = Revision.new( - @page, - 1, - 'The W3C body (http://www.w3c.org) sets web standards', - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + @page, 1, 'The W3C body (http://www.w3c.org) sets web standards', + Time.local(2004, 4, 4, 16, 50), 'MarkReid') @revision_with_link_in_parentheses = Revision.new( - @page, - 1, - 'Instiki is a "Wiki Clone":http://www.c2.com/cgi/wiki?WikiWikiClones ("What is a wiki?":http://wiki.org/wiki.cgi?WhatIsWiki) that\'s so easy to setup', - Time.local(2004, 4, 4, 16, 50), - "MarkReid" + @page, 1, + 'Instiki is a "Wiki Clone":http://www.c2.com/cgi/wiki?WikiWikiClones ' + + '("What is a wiki?":http://wiki.org/wiki.cgi?WhatIsWiki) that\'s so easy to setup', + Time.local(2004, 4, 4, 16, 50), 'MarkReid' ) - @revision_with_image_link = Revision.new( - @page, - 1, + @revision_with_image_link = Revision.new(@page, 1, 'This !http://hobix.com/sample.jpg! is a Textile image link.', - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + Time.local(2004, 4, 4, 16, 50), 'MarkReid') - @revision_with_nowiki_text = Revision.new( - @page, - 1, + @revision_with_nowiki_text = Revision.new(@page, 1, 'Do not mark up [[this text]] or http://www.thislink.com.', - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) + Time.local(2004, 4, 4, 16, 50), 'MarkReid') - @revision_with_bracketted_wiki_word = Revision.new( - @page, - 1, + @revision_with_bracketted_wiki_word = Revision.new(@page, 1, 'This is a WikiWord and a tricky name [[Sperberg-McQueen]].', - Time.local(2004, 4, 4, 16, 50), - "MarkReid" - ) - + Time.local(2004, 4, 4, 16, 50), 'MarkReid') end def test_wiki_words @@ -127,23 +85,24 @@ class RevisionTest < Test::Unit::TestCase end def test_content_with_wiki_links - assert_equal "

His Way? would be My Way in kinda That Way in His Way? though My Way OverThere—see Smart Engine in that Smart Engine GUI?

", @revision.display_content + assert_equal '

His Way? ' + + 'would be My Way in kinda ' + + 'That Way in ' + + 'His Way? ' + + 'though My Way OverThere—see ' + + 'Smart Engine in that ' + + 'Smart Engine GUI' + + '?

', + @revision.display_content end def test_bluecloth @web.markup = :markdown - @revision = Revision.new( - @page, - 1, - "My Headline\n===========\n\n that SmartEngineGUI", - Time.local(2004, 4, 4, 16, 50), - "DavidHeinemeierHansson" - ) + @revision = Revision.new(@page, 1, "My Headline\n===========\n\n that SmartEngineGUI", + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') - @revision_with_code_block = Revision.new( - @page, - 1, + @revision_with_code_block = Revision.new(@page, 1, [ 'This is a code block:', '', ' def a_method(arg)', @@ -166,84 +125,104 @@ class RevisionTest < Test::Unit::TestCase def test_rdoc @web.markup = :rdoc - @revision = Revision.new( - @page, - 1, - "+hello+ that SmartEngineGUI", - Time.local(2004, 4, 4, 16, 50), - "DavidHeinemeierHansson" - ) + @revision = Revision.new(@page, 1, '+hello+ that SmartEngineGUI', + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') - assert_equal "hello that Smart Engine GUI?\n\n", @revision.display_content + assert_equal "hello that Smart Engine GUI' + + "?\n\n", @revision.display_content end def test_content_with_auto_links - assert_equal "

http://www.loudthinking.com/ points to That Way from david@loudthinking.com

", @revision_with_auto_links.display_content + assert_equal '

http://www.loudthinking.com/ ' + + 'points to That Way from ' + + 'david@loudthinking.com

', + @revision_with_auto_links.display_content end def test_content_with_aliased_links - assert_equal "

Would a clever motor go by any other name?

", @revision_with_aliased_links.display_content + assert_equal '

Would a clever motor' + + ' go by any other name?

', @revision_with_aliased_links.display_content end def test_content_with_wikiword_in_em - assert_equal "

should we go That Way or This Way?

", @revision_with_wiki_word_in_em.display_content + assert_equal '

should we go ' + + 'That Way or This Way?' + + '

', @revision_with_wiki_word_in_em.display_content end def test_content_with_wikiword_in_tag - assert_equal "

That is some Stylish Emphasis

", @revision_with_wikiword_in_tag.display_content + assert_equal '

That is some Stylish Emphasis

', + @revision_with_wikiword_in_tag.display_content end def test_content_with_pre_blocks - assert_equal "A class SmartEngine end would not mark up
CodeBlocks
", @revision_with_pre_blocks.display_content + assert_equal 'A class SmartEngine end would not mark up
CodeBlocks
', + @revision_with_pre_blocks.display_content end def test_content_with_autolink_in_parentheses - assert_equal '

The W3C body (http://www.w3c.org) sets web standards

', @revision_with_autolink_in_parentheses.display_content + assert_equal '

The W3C body (' + + 'http://www.w3c.org) sets web standards

', + @revision_with_autolink_in_parentheses.display_content end def test_content_with_link_in_parentheses - assert_equal '

Instiki is a Wiki Clone (What is a wiki?) that’s so easy to setup

', @revision_with_link_in_parentheses.display_content + assert_equal '

Instiki is a Wiki Clone' + + ' (What is a wiki?) that’s ' + + 'so easy to setup

', @revision_with_link_in_parentheses.display_content end def test_content_with_image_link - assert_equal '

This is a Textile image link.

', @revision_with_image_link.display_content + assert_equal '

This is a Textile image ' + + 'link.

', @revision_with_image_link.display_content end def test_content_with_nowiki_text - assert_equal '

Do not mark up [[this text]] or http://www.thislink.com.

', @revision_with_nowiki_text.display_content + assert_equal '

Do not mark up [[this text]] or http://www.thislink.com.

', + @revision_with_nowiki_text.display_content end def test_content_with_bracketted_wiki_word @web.brackets_only = true - assert_equal '

This is a WikiWord and a tricky name Sperberg-McQueen?.

', @revision_with_bracketted_wiki_word.display_content + assert_equal '

This is a WikiWord and a tricky name ' + + 'Sperberg-McQueen?.

', + @revision_with_bracketted_wiki_word.display_content end def test_content_for_export - assert_equal "

His Way would be My Way in kinda That Way in His Way though My Way OverThere—see Smart Engine in that Smart Engine GUI

", @revision.display_content_for_export + assert_equal '

His Way would be ' + + 'My Way in kinda ' + + 'That Way in ' + + 'His Way though ' + + 'My Way OverThere—see ' + + 'Smart Engine in that ' + + 'Smart Engine GUI

', + @revision.display_content_for_export end def test_double_replacing @revision.content = "VersionHistory\r\n\r\ncry VersionHistory" - assert_equal( - "

Version History?

\n\n\t

cry Version History?

", - @revision.display_content - ) + assert_equal '

Version History' + + "?

\n\n\t

cry " + + 'Version History?' + + '

', + @revision.display_content @revision.clear_display_cache @revision.content = "f\r\nVersionHistory\r\n\r\ncry VersionHistory" - assert_equal( - "

f
\nVersion History?

\n\n\t

cry Version History?

", - @revision.display_content - ) + assert_equal "

f
\nVersion History" + + "?

\n\n\t

cry " + + "Version History?" + + "

", + @revision.display_content end def test_difficult_wiki_words @revision.content = "[[It's just awesome GUI!]]" - assert_equal( - "

It’s just awesome GUI!?

", - @revision.display_content - ) + assert_equal "

It’s just awesome GUI" + + "!?

", + @revision.display_content end def test_revisions_diff @@ -253,9 +232,15 @@ class RevisionTest < Test::Unit::TestCase page.web = web page.revisions = [ 0 ] - page.revisions << Revision.new(page, 1, "What a blue and lovely morning", Time.local(2004, 4, 4, 16, 50), "DavidHeinemeierHansson") - page.revisions << Revision.new(page, 2, "What a red and lovely morning today", Time.local(2004, 4, 4, 16, 50), "DavidHeinemeierHansson") + page.revisions << Revision.new(page, 1, 'What a blue and lovely morning', + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') + + page.revisions << Revision.new(page, 2, 'What a red and lovely morning today', + Time.local(2004, 4, 4, 16, 50), 'DavidHeinemeierHansson') - assert_equal "

What a blue red and lovely morningmorning today

", page.revisions.last.display_diff + assert_equal "

What a blue red " + + "and lovely morningmorning " + + "today

", page.revisions.last.display_diff end -end \ No newline at end of file + +end