]> source.dussan.org Git - redmine.git/commitdiff
scm: git: add tests for path encoding cat, diff and blame in unit adapter test (...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 8 Mar 2011 06:10:07 +0000 (06:10 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 8 Mar 2011 06:10:07 +0000 (06:10 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5044 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/lib/redmine/scm/adapters/git_adapter_test.rb

index 80148a976c74f0dc6831fb6059524d23a0a75684..c22fa936d40b1bcd063037e200a4007b3998f90a 100644 (file)
@@ -12,10 +12,22 @@ begin
 
     FELIX_UTF8 = "Felix Schäfer"
     FELIX_HEX  = "Felix Sch\xC3\xA4fer"
+    CHAR_1_HEX = "\xc3\x9c"
 
     if File.directory?(REPOSITORY_PATH)
       def setup
-        @adapter = Redmine::Scm::Adapters::GitAdapter.new(REPOSITORY_PATH)
+        @adapter = Redmine::Scm::Adapters::GitAdapter.new(
+                      REPOSITORY_PATH,
+                      nil,
+                      nil,
+                      nil,
+                      'ISO-8859-1'
+                      )
+        assert @adapter
+        @char_1        = CHAR_1_HEX.dup
+        if @char_1.respond_to?(:force_encoding)
+          @char_1.force_encoding('UTF-8')
+        end
       end
 
       def test_scm_version
@@ -104,6 +116,22 @@ begin
         assert_equal "2010-09-18 19:59:46".to_time, last_rev.time
       end
 
+      def test_latin_1_path
+        if Redmine::Platform.mswin?
+          # TODO
+        else
+          p2 = "latin-1-dir/test-#{@char_1}-2.txt"
+          ['4fc55c43bf3d3dc2efb66145365ddc17639ce81e', '4fc55c43bf3'].each do |r1|
+            assert @adapter.diff(p2, r1)
+            assert @adapter.cat(p2, r1)
+            assert_equal 1, @adapter.annotate(p2, r1).lines.length
+            ['64f1f3e89ad1cb57976ff0ad99a107012ba3481d', '64f1f3e89ad1cb5797'].each do |r2|
+              assert @adapter.diff(p2, r1, r2)
+            end      
+          end      
+        end
+      end
+
       private
 
       def test_scm_version_for(scm_command_version, version)