From 396323726b55cd0ec7d7f3362b7091cd998f8708 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 2 Feb 2014 12:19:26 +0000 Subject: [PATCH] scm: mercurial: add test helper method to switch short or long id (#14361) git-svn-id: http://svn.redmine.org/redmine/trunk@12771 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/repository_mercurial_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index d2efd848a..0ac7e1c9a 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -502,6 +502,18 @@ class RepositoryMercurialTest < ActiveSupport::TestCase assert_nil changeset.next end end + + def test_scmid_for_assert + rev = "0123456789012345678901234567890123456789" + assert_equal rev, scmid_for_assert(rev, false) + assert_equal "012345678901", scmid_for_assert(rev, true) + end + + private + + def scmid_for_assert(hex, is_short=true) + is_short ? hex[0, 12] : hex + end else puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!" def test_fake; assert true end -- 2.39.5