From cef7e917773e0d081d036483dfb7ee5ccdf72d0c Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 19 Dec 2020 17:32:12 +0000 Subject: [PATCH] shorten long line of test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20671 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../wiki_formatting/textile_formatter_test.rb | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 8098a54c0..c89613793 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -224,9 +224,12 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase def test_abbreviations assert_html_output( - 'this is an abbreviation: GPL(General Public License)' => 'this is an abbreviation: GPL', - '2 letters JP(Jean-Philippe) abbreviation' => '2 letters JP abbreviation', - 'GPL(This is a double-quoted "title")' => 'GPL' + 'this is an abbreviation: GPL(General Public License)' => + 'this is an abbreviation: GPL', + '2 letters JP(Jean-Philippe) abbreviation' => + '2 letters JP abbreviation', + 'GPL(This is a double-quoted "title")' => + 'GPL' ) end @@ -401,8 +404,12 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase def test_textile_should_escape_image_urls # this is onclick="alert('XSS');" in encoded form - raw = '!/images/comment.png"onclick=alert('XSS');"!' - expected = '

' + raw = + '!/images/comment.png"onclick=alert('XSS');"!' + expected = + '

' assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') end @@ -459,11 +466,22 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase def test_update_section_should_update_the_requested_section replacement = "New text" - assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement) - assert_equal [STR_WITHOUT_PRE[0..1], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(3, replacement) - assert_equal [STR_WITHOUT_PRE[0..2], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(5, replacement) - assert_equal [STR_WITHOUT_PRE[0..3], replacement].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(6, replacement) - + assert_equal( + [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"), + @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement) + ) + assert_equal( + [STR_WITHOUT_PRE[0..1], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), + @formatter.new(TEXT_WITHOUT_PRE).update_section(3, replacement) + ) + assert_equal( + [STR_WITHOUT_PRE[0..2], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), + @formatter.new(TEXT_WITHOUT_PRE).update_section(5, replacement) + ) + assert_equal( + [STR_WITHOUT_PRE[0..3], replacement].flatten.join("\n\n"), + @formatter.new(TEXT_WITHOUT_PRE).update_section(6, replacement) + ) assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(0, replacement) assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(10, replacement) end @@ -595,9 +613,17 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase def test_should_allow_valid_language_class_attribute_on_code_tags # language name is double-quoted - assert_html_output({"test" => "test"}, false) + assert_html_output( + {"test" => + "test"}, + false + ) # language name is single-quoted - assert_html_output({"test" => "test"}, false) + assert_html_output( + {"test" => + "test"}, + false + ) end def test_should_not_allow_valid_language_class_attribute_on_non_code_offtags -- 2.39.5