]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: add unit test for copied file (#7064).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 5 Jan 2011 15:03:35 +0000 (15:03 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 5 Jan 2011 15:03:35 +0000 (15:03 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4636 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_mercurial_test.rb

index 481a223b827a02eac14648a8a1cc171d09e8f332..27e45fcc1f6b5becc81040f1b33cba90e1547783 100644 (file)
@@ -96,6 +96,31 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
       changesets = @repository.latest_changesets('/sql_escape/underscore_dir/understrike_file.txt', nil)
       assert_equal %w|12 9|, changesets.collect(&:revision)
     end
+
+    def test_copied_files
+      @repository.fetch_changesets
+      @repository.reload
+
+      cs1 = @repository.changesets.find_by_revision('13')
+      c1  = cs1.changes
+      assert_equal 2, c1.size
+
+      assert_equal 'A', c1[0].action
+      assert_equal '/sql_escape/percent%dir/percentfile1.txt',  c1[0].path
+      assert_equal '/sql_escape/percent%dir/percent%file1.txt', c1[0].from_path
+
+      assert_equal 'A', c1[1].action
+      assert_equal '/sql_escape/underscore_dir/understrike-file.txt', c1[1].path
+      assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
+
+      cs2 = @repository.changesets.find_by_revision('15')
+      c2  = cs2.changes
+      assert_equal 1, c2.size
+
+      assert_equal 'A', c2[0].action
+      assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
+      assert_equal '/README', c2[0].from_path
+    end
   else
     puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
     def test_fake; assert true end