Commits

Toshi MARUYAMA committed 9328441

rearrange unit tests of hg-use-scmid.patch/find-changeset.diff.

Comments (0)

Files changed (1)

hg-use-scmid.patch/find-changeset.diff

 # HG changeset patch
-# Parent 43704dd8cf49bb49afa6556722bd87085d339253
+# Parent 217e197c217b47b8ffc8bde5d9a8fed6eced4307
 repository: mercurial: accept both of revision and nodeid as changeset id
 
 Signed-off-by: Yuya Nishihara <yuya@tcha.org>
 diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb
 --- a/app/models/repository/mercurial.rb
 +++ b/app/models/repository/mercurial.rb
-@@ -55,6 +55,17 @@ class Repository::Mercurial < Repository
+@@ -55,6 +55,17 @@
      entries
    end
  
 diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb
 --- a/test/functional/repositories_mercurial_controller_test.rb
 +++ b/test/functional/repositories_mercurial_controller_test.rb
-@@ -75,6 +75,14 @@ class RepositoriesMercurialControllerTes
+@@ -75,6 +75,14 @@
        assert_equal ['delete.png'], assigns(:entries).collect(&:name)
      end
      
      def test_changes
        get :changes, :id => 3, :path => ['images', 'edit.png']
        assert_response :success
+diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
+--- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
++++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
+@@ -80,6 +80,18 @@
+       assert_nil @adapter.cat("sources/welcome_controller.rb")
+     end
+ 
++    def test_access_by_nodeid
++      path = 'sources/welcome_controller.rb'
++      assert_equal @adapter.cat(path, 2),
++                   @adapter.cat(path, '400bb8672109')
++    end
++
++    def test_access_by_fuzzy_nodeid
++      path = 'sources/welcome_controller.rb'
++      # falls back to nodeid
++      assert_equal @adapter.cat(path, 2), @adapter.cat(path, '400')
++    end
++
+   else
+     puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
+     def test_fake; assert true end
 diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb
 --- a/test/unit/repository_mercurial_test.rb
 +++ b/test/unit/repository_mercurial_test.rb
-@@ -51,7 +51,9 @@ class RepositoryMercurialTest < ActiveSu
+@@ -51,7 +51,9 @@
      
      def test_entries
        assert_equal 2, @repository.entries("sources", 2).size
      end
  
      def test_locate_on_outdated_repository
-@@ -68,6 +70,16 @@ class RepositoryMercurialTest < ActiveSu
-       assert_nil @repository.scm.cat("sources/welcome_controller.rb")
-     end
- 
-+    def test_access_by_nodeid
-+      path = 'sources/welcome_controller.rb'
-+      assert_equal @repository.scm.cat(path, 2), @repository.scm.cat(path, '400bb8672109')
-+    end
-+
-+    def test_access_by_fuzzy_nodeid
-+      path = 'sources/welcome_controller.rb'
-+      assert_equal @repository.scm.cat(path, 2), @repository.scm.cat(path, '400')  # falls back to nodeid
-+    end
-+
-     def test_isodatesec
-       @repository.fetch_changesets
-       @repository.reload