]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: add tests for "nodes_in_branch()" method in adapter (#7246, #4455).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 13 Mar 2011 10:52:03 +0000 (10:52 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 13 Mar 2011 10:52:03 +0000 (10:52 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5103 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb

index 6c9bdd580fa3bfedad7c85fbe93739fb5e119630..5c423f0c39b856057f90a5bcab9852ee7495ad39 100644 (file)
@@ -277,6 +277,36 @@ begin
         end      
       end
 
+      def test_nodes_in_branch
+         [
+            'default',
+            @branch_char_1,
+            'branch (1)[2]&,%.-3_4',
+            @branch_char_0,
+            'test_branch.latin-1',
+            'test-branch-00',
+               ].each do |bra|
+          nib0 = @adapter.nodes_in_branch(bra, '', bra, 0)
+          assert nib0
+          nib1 = @adapter.nodes_in_branch(bra, '', bra, 0, :limit => 1)
+          assert_equal 1, nib1.size
+          case bra
+            when 'branch (1)[2]&,%.-3_4'
+              assert_equal 3, nib0.size
+              assert_equal nib0[0], 'afc61e85bde7'
+              nib2 = @adapter.nodes_in_branch(bra, '', bra, 0, :limit => 2)
+              assert_equal 2, nib2.size
+              assert_equal nib2[1], '933ca60293d7'
+            when @branch_char_1
+              assert_equal 2, nib0.size
+              assert_equal nib0[1], '08ff3227303e'
+              nib2 = @adapter.nodes_in_branch(bra, '', bra, 0, :limit => 1)
+              assert_equal 1, nib2.size
+              assert_equal nib2[0], '7bbf4c738e71'
+          end
+        end
+      end
+
       private
 
       def test_hgversion_for(hgversion, version)