0002-Update-tests-and-add-a-test-for-empty-commit-message.patch

Yuichi HARADA, 2021-12-24 06:38

Download (4.67 KB)

View differences:

test/functional/repositories_mercurial_controller_test.rb
27 27

  
28 28
  REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
29 29
  PRJ_ID     = 3
30
  NUM_REV    = 40
30
  NUM_REV    = 43
31 31

  
32 32
  def setup
33 33
    super
test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
87 87
        adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo)
88 88
        repo_path =  adp.info.root_url.tr('\\', "/")
89 89
        assert_equal REPOSITORY_PATH, repo_path
90
        assert_equal '39', adp.info.lastrev.revision
91
        assert_equal '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4', adp.info.lastrev.scmid
90
        assert_equal '42', adp.info.lastrev.revision
91
        assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', adp.info.lastrev.scmid
92 92
      end
93 93
    end
94 94

  
......
113 113
      assert_equal "ctrl-s\u0013message", revisions[0].message
114 114
    end
115 115

  
116
    def test_empty_message
117
      revisions = @adapter.revisions(nil, '05b4c556a8a1', '05b4c556a8a1')
118
      assert_equal 1, revisions.size
119
      assert_equal '41', revisions[0].revision
120
      assert_equal 'jsmith <jsmith@foo.bar>', revisions[0].author
121
      assert_equal '', revisions[0].message
122
    end
123

  
116 124
    def test_parents
117 125
      revs1 = @adapter.revisions(nil, 0, 0)
118 126
      assert_equal 1, revs1.size
......
349 357
      @adapter.branches.each do |b|
350 358
        branches << b
351 359
      end
352
      assert_equal 9, branches.length
360
      assert_equal 10, branches.length
361

  
362
      branch = branches[-10]
363
      assert_equal 'branch-empty-message', branch.to_s
364
      assert_equal '42', branch.revision
365
      assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', branch.scmid
353 366

  
354 367
      branch = branches[-9]
355 368
      assert_equal 'double"quote"branch', branch.to_s
......
400 413
    def test_branchmap
401 414
      bm =
402 415
        {
416
          'branch-empty-message'  => 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7',
403 417
          'double"quote"branch'   => '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4',
404 418
          'issue-23055-ctrl-char' => '3e998343166a1b8273973bcd46dd2bad74344d74',
405 419
          'default'               => '31eeee7395c8c78e66dd54c50addd078d10b2355',
test/unit/repository_mercurial_test.rb
25 25
  include Redmine::I18n
26 26

  
27 27
  REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
28
  NUM_REV = 40
28
  NUM_REV = 43
29 29

  
30 30
  def setup
31 31
    User.current = nil
......
170 170
      @repository.fetch_changesets
171 171
      @project.reload
172 172
      assert_equal NUM_REV, @repository.changesets.count
173
      assert_equal 51, @repository.filechanges.count
173
      assert_equal 53, @repository.filechanges.count
174 174
      rev0 = @repository.changesets.find_by_revision('0')
175 175
      assert_equal "Initial import.\nThe repository contains 3 files.",
176 176
                   rev0.comments
......
597 597
      @repository.fetch_changesets
598 598
      @project.reload
599 599
      assert_equal NUM_REV, @repository.changesets.count
600
      [(NUM_REV - 1).to_s, "04aed9840e92", "04aed"].each do |r1|
600
      [(NUM_REV - 1).to_s, "ba20ebce08db", "ba20e"].each do |r1|
601 601
        changeset = @repository.find_changeset_by_name(r1)
602 602
        assert_nil changeset.next
603 603
      end
604
-