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
This commit is contained in:
Toshi MARUYAMA 2011-03-08 06:10:07 +00:00
parent dc4ab44938
commit 04aca2fcb9
1 changed files with 29 additions and 1 deletions

View 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)