]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: refactor MercurialAdapterTest#test_branches for easy adding new branc...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 22 Mar 2020 16:15:14 +0000 (16:15 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 22 Mar 2020 16:15:14 +0000 (16:15 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19605 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index a260373eec126036636c0c74a55dae4a489fcf26..93621a8b2e3518284aacf8244ffa95df6ddeb4b7 100644 (file)
@@ -332,32 +332,46 @@ class MercurialAdapterTest < ActiveSupport::TestCase
     end
 
     def test_branches
-      brs = []
+      branches = []
       @adapter.branches.each do |b|
-        brs << b
+        branches << b
       end
-      assert_equal 7, brs.length
-      assert_equal 'default', brs[0].to_s
-      assert_equal '31', brs[0].revision
-      assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355', brs[0].scmid
-      assert_equal 'test-branch-01', brs[1].to_s
-      assert_equal '30', brs[1].revision
-      assert_equal 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7', brs[1].scmid
-      assert_equal @branch_char_1, brs[2].to_s
-      assert_equal '27', brs[2].revision
-      assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', brs[2].scmid
-      assert_equal 'branch (1)[2]&,%.-3_4', brs[3].to_s
-      assert_equal '25', brs[3].revision
-      assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', brs[3].scmid
-      assert_equal @branch_char_0, brs[4].to_s
-      assert_equal '23', brs[4].revision
-      assert_equal 'c8d3e4887474af6a589190140508037ebaa9d9c3', brs[4].scmid
-      assert_equal 'test_branch.latin-1', brs[5].to_s
-      assert_equal '22', brs[5].revision
-      assert_equal 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768', brs[5].scmid
-      assert_equal 'test-branch-00', brs[6].to_s
-      assert_equal '13', brs[6].revision
-      assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', brs[6].scmid
+      assert_equal 7, branches.length
+
+      branch_default = branches[0]
+      assert_equal 'default', branch_default.to_s
+      assert_equal '31', branch_default.revision
+      assert_equal '31eeee7395c8c78e66dd54c50addd078d10b2355', branch_default.scmid
+
+      branch_test01 = branches[1]
+      assert_equal 'test-branch-01', branch_test01.to_s
+      assert_equal '30', branch_test01.revision
+      assert_equal 'ad4dc4f80284a4f9168b77e0b6de288e5d207ee7', branch_test01.scmid
+
+      branch_char_1 = branches[2]
+      assert_equal @branch_char_1, branch_char_1.to_s
+      assert_equal '27', branch_char_1.revision
+      assert_equal '7bbf4c738e7145149d2e5eb1eed1d3a8ddd3b914', branch_char_1.scmid
+
+      branch_bracket = branches[3]
+      assert_equal 'branch (1)[2]&,%.-3_4', branch_bracket.to_s
+      assert_equal '25', branch_bracket.revision
+      assert_equal 'afc61e85bde74de930e5846c8451bd55b5bafc9c', branch_bracket.scmid
+
+      branch_char_0 = branches[4]
+      assert_equal @branch_char_0, branch_char_0.to_s
+      assert_equal '23', branch_char_0.revision
+      assert_equal 'c8d3e4887474af6a589190140508037ebaa9d9c3', branch_char_0.scmid
+
+      branch_latin1 = branches[5]
+      assert_equal 'test_branch.latin-1', branch_latin1.to_s
+      assert_equal '22', branch_latin1.revision
+      assert_equal 'c2ffe7da686aa3d956e59f2a2854cf8980a8b768', branch_latin1.scmid
+
+      branch_test00 = branches[6]
+      assert_equal 'test-branch-00',branch_test00.to_s
+      assert_equal '13', branch_test00.revision
+      assert_equal '3a330eb329586ea2adb3f83237c23310e744ebe9', branch_test00.scmid
     end
 
     def test_branchmap