diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-04-30 02:07:17 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-04-30 02:07:17 +0000 |
commit | d94226dd4ccc5757a94f3fe1542cdd736831fd48 (patch) | |
tree | 2bf1e3e34e409a94a8fed0e87b28bba15ad391e9 | |
parent | 8374ae85136ffb92440abd053fb225c869ab62c0 (diff) | |
download | redmine-d94226dd4ccc5757a94f3fe1542cdd736831fd48.tar.gz redmine-d94226dd4ccc5757a94f3fe1542cdd736831fd48.zip |
add test to UnifiedDiffTest to keep similar git footer line (#33357)
git-svn-id: http://svn.redmine.org/redmine/trunk@19734 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | test/unit/lib/redmine/unified_diff_test.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb index 0f3961991..4a1ec662f 100644 --- a/test/unit/lib/redmine/unified_diff_test.rb +++ b/test/unit/lib/redmine/unified_diff_test.rb @@ -375,6 +375,46 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase end end + def test_keep_similar_git_footer_line + raw = <<~DIFF + diff --git a/test1.txt b/test1.txt + --- a/test1.txt + +++ b/test1.txt + @@ -1,11 +1,6 @@ + $ git init --bare git_utf8_repository + $ hg init git_utf8_repository_hg + $ cd git_utf8_repository_hg + -- + -Next line has white space after '-' + -- + --- + -- + $ touch test.txt + $ hg add test.txt + $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"` + diff --git a/test2.txt b/test2.txt + --- a/test2.txt + +++ b/test2.txt + @@ -5,9 +5,4 @@ + $ hg add test.txt + $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"` + $ hg bookmark master + -- + -Next line has white space after '-' + -- + --- + -- + $ hg push ../git_utf8_repository + DIFF + lines = raw.split("\n") + assert_equal '-- ', lines[9] + assert_equal '-- ', lines[24] + diff = Redmine::UnifiedDiff.new(raw, :type => 'sbs') + assert_equal 2, diff.size + assert_equal 11, diff[0].size + assert_equal 9, diff[1].size + end + private def read_diff_fixture(filename) |