Project

General

Profile

Defect #36258 » 0002-Update-tests-and-add-a-test-for-empty-commit-message.patch

Yuichi HARADA, 2021-12-24 06:38

View differences:

test/functional/repositories_mercurial_controller_test.rb
REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
PRJ_ID = 3
NUM_REV = 40
NUM_REV = 43
def setup
super
test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo)
repo_path = adp.info.root_url.tr('\\', "/")
assert_equal REPOSITORY_PATH, repo_path
assert_equal '39', adp.info.lastrev.revision
assert_equal '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4', adp.info.lastrev.scmid
assert_equal '42', adp.info.lastrev.revision
assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', adp.info.lastrev.scmid
end
end
......
assert_equal "ctrl-s\u0013message", revisions[0].message
end
def test_empty_message
revisions = @adapter.revisions(nil, '05b4c556a8a1', '05b4c556a8a1')
assert_equal 1, revisions.size
assert_equal '41', revisions[0].revision
assert_equal 'jsmith <jsmith@foo.bar>', revisions[0].author
assert_equal '', revisions[0].message
end
def test_parents
revs1 = @adapter.revisions(nil, 0, 0)
assert_equal 1, revs1.size
......
@adapter.branches.each do |b|
branches << b
end
assert_equal 9, branches.length
assert_equal 10, branches.length
branch = branches[-10]
assert_equal 'branch-empty-message', branch.to_s
assert_equal '42', branch.revision
assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', branch.scmid
branch = branches[-9]
assert_equal 'double"quote"branch', branch.to_s
......
def test_branchmap
bm =
{
'branch-empty-message' => 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7',
'double"quote"branch' => '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4',
'issue-23055-ctrl-char' => '3e998343166a1b8273973bcd46dd2bad74344d74',
'default' => '31eeee7395c8c78e66dd54c50addd078d10b2355',
test/unit/repository_mercurial_test.rb
include Redmine::I18n
REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
NUM_REV = 40
NUM_REV = 43
def setup
User.current = nil
......
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 51, @repository.filechanges.count
assert_equal 53, @repository.filechanges.count
rev0 = @repository.changesets.find_by_revision('0')
assert_equal "Initial import.\nThe repository contains 3 files.",
rev0.comments
......
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
[(NUM_REV - 1).to_s, "04aed9840e92", "04aed"].each do |r1|
[(NUM_REV - 1).to_s, "ba20ebce08db", "ba20e"].each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.next
end
(3-3/3)