From: Toshi MARUYAMA Date: Fri, 4 Mar 2011 14:03:19 +0000 (+0000) Subject: scm: mercurial: add changesets order test in unit model test (#5357). X-Git-Tag: 1.2.0~828 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8d3773e0e1d0e259a2a193f31515ee910eb88626;p=redmine.git scm: mercurial: add changesets order test in unit model test (#5357). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5002 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 6d8d7a474..6e7938f6c 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -212,6 +212,46 @@ class RepositoryMercurialTest < ActiveSupport::TestCase changesets = @repository.latest_changesets(path, nil) assert_equal %w|13 12 9|, changesets.collect(&:revision) end + + def test_previous + @repository.fetch_changesets + @repository.reload + %w|26 3ae45e2d177d 3ae4|.each do |r1| + changeset = @repository.find_changeset_by_name(r1) + %w|25 afc61e85bde7 afc6|.each do |r2| + assert_equal @repository.find_changeset_by_name(r2), changeset.previous + end + end + end + + def test_previous_nil + @repository.fetch_changesets + @repository.reload + %w|0 0885933ad4f6 0885|.each do |r1| + changeset = @repository.find_changeset_by_name(r1) + assert_nil changeset.previous + end + end + + def test_next + @repository.fetch_changesets + @repository.reload + %w|25 afc61e85bde7 afc6|.each do |r2| + changeset = @repository.find_changeset_by_name(r2) + %w|26 3ae45e2d177d 3ae4|.each do |r1| + assert_equal @repository.find_changeset_by_name(r1), changeset.next + end + end + end + + def test_next_nil + @repository.fetch_changesets + @repository.reload + %w|26 3ae45e2d177d 3ae4|.each do |r1| + changeset = @repository.find_changeset_by_name(r1) + assert_nil changeset.next + end + end else puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!" def test_fake; assert true end