]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: add changesets order test in unit model test (#5357).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 4 Mar 2011 14:03:19 +0000 (14:03 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 4 Mar 2011 14:03:19 +0000 (14:03 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5002 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_mercurial_test.rb

index 6d8d7a4741b4311d5b02c58853d95a8961852e75..6e7938f6c89ee42d4cfdc69650eb576db9c75228 100644 (file)
@@ -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