From 1bf33bb619591b72ca1765345ce673902e3ae2e3 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 5 Jan 2011 15:03:35 +0000 Subject: [PATCH] scm: mercurial: add unit test for copied file (#7064). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4636 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/repository_mercurial_test.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 481a223b82..27e45fcc1f 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -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