From: Toshi MARUYAMA Date: Tue, 8 Mar 2011 06:10:07 +0000 (+0000) Subject: scm: git: add tests for path encoding cat, diff and blame in unit adapter test (... X-Git-Tag: 1.2.0~798 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=04aca2fcb9611d1ae830950c3c21c33690ed0a99;p=redmine.git scm: git: add tests for path encoding cat, diff and blame in unit adapter test (#5251). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5044 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 80148a976..c22fa936d 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -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)