diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-09-19 02:29:11 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-09-19 02:29:11 +0000 |
commit | f18edc4e1c045b968cba8d8f905257e63a1c0d5c (patch) | |
tree | 0fb429acc0473de1df9cdf022da995f8aaa25d88 /test | |
parent | 0af04b8ae031398adbeebf5536f934d3c1ba9148 (diff) | |
download | redmine-f18edc4e1c045b968cba8d8f905257e63a1c0d5c.tar.gz redmine-f18edc4e1c045b968cba8d8f905257e63a1c0d5c.zip |
use git diff format for all diff (#11868)
Mercurial diff uses git format.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10428 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/repositories_mercurial_controller_test.rb | 14 | ||||
-rw-r--r-- | test/unit/lib/redmine/unified_diff_test.rb | 54 |
2 files changed, 68 insertions, 0 deletions
diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index bfcf2d669..d4cefbd22 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -371,6 +371,20 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase end end + def test_diff_should_show_modified_filenames + get :diff, :id => PRJ_ID, :rev => '400bb8672109', :type => 'inline' + assert_response :success + assert_template 'diff' + assert_select 'th.filename', :text => 'sources/watchers_controller.rb' + end + + def test_diff_should_show_deleted_filenames + get :diff, :id => PRJ_ID, :rev => 'b3a615152df8', :type => 'inline' + assert_response :success + assert_template 'diff' + assert_select 'th.filename', :text => 'sources/welcome_controller.rb' + end + def test_annotate get :annotate, :id => PRJ_ID, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb index 52c5ccf5f..61ed3df83 100644 --- a/test/unit/lib/redmine/unified_diff_test.rb +++ b/test/unit/lib/redmine/unified_diff_test.rb @@ -169,6 +169,60 @@ diff -r 000000000000 -r ea98b14f75f0 README4 DIFF ) assert_equal 4, diff.size + assert_equal "README1", diff[0].file_name + end + + def test_both_git_diff + diff = Redmine::UnifiedDiff.new(<<-DIFF +# HG changeset patch +# User test +# Date 1348014182 -32400 +# Node ID d1c871b8ef113df7f1c56d41e6e3bfbaff976e1f +# Parent 180b6605936cdc7909c5f08b59746ec1a7c99b3e +modify test1.txt + +diff -r 180b6605936c -r d1c871b8ef11 test1.txt +--- a/test1.txt ++++ b/test1.txt +@@ -1,1 +1,1 @@ +-test1 ++modify test1 +DIFF + ) + assert_equal 1, diff.size + assert_equal "test1.txt", diff[0].file_name + end + + def test_include_a_b_slash + diff = Redmine::UnifiedDiff.new(<<-DIFF +--- test1.txt ++++ b/test02.txt +@@ -1 +0,0 @@ +-modify test1 +DIFF + ) + assert_equal 1, diff.size + assert_equal "b/test02.txt", diff[0].file_name + + diff = Redmine::UnifiedDiff.new(<<-DIFF +--- a/test1.txt ++++ a/test02.txt +@@ -1 +0,0 @@ +-modify test1 +DIFF + ) + assert_equal 1, diff.size + assert_equal "a/test02.txt", diff[0].file_name + + diff = Redmine::UnifiedDiff.new(<<-DIFF +--- a/test1.txt ++++ test02.txt +@@ -1 +0,0 @@ +-modify test1 +DIFF + ) + assert_equal 1, diff.size + assert_equal "test02.txt", diff[0].file_name end private |