Bazaar log depends on locale. On Japanese Windows, standard out is CP932. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4961 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f03e338880
commit
7664892b5d
@ -223,17 +223,32 @@ class ChangesetTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_comments_should_be_converted_to_utf8
|
def test_comments_should_be_converted_to_utf8
|
||||||
with_settings :commit_logs_encoding => 'ISO-8859-1' do
|
with_settings :commit_logs_encoding => 'ISO-8859-1' do
|
||||||
c = Changeset.new
|
proj = Project.find(3)
|
||||||
c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
|
str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
|
||||||
|
r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
|
||||||
|
assert r
|
||||||
|
c = Changeset.new(:repository => r,
|
||||||
|
:committed_on => Time.now,
|
||||||
|
:revision => '123',
|
||||||
|
:scmid => '12345',
|
||||||
|
:comments => str)
|
||||||
|
assert( c.save )
|
||||||
assert_equal "Texte encodé en ISO-8859-1.", c.comments
|
assert_equal "Texte encodé en ISO-8859-1.", c.comments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_utf8_sequences_in_comments_should_be_stripped
|
def test_invalid_utf8_sequences_in_comments_should_be_stripped
|
||||||
with_settings :commit_logs_encoding => 'UTF-8' do
|
with_settings :commit_logs_encoding => 'UTF-8' do
|
||||||
c = Changeset.new
|
proj = Project.find(3)
|
||||||
str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
|
str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
|
||||||
c.comments = str
|
r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
|
||||||
|
assert r
|
||||||
|
c = Changeset.new(:repository => r,
|
||||||
|
:committed_on => Time.now,
|
||||||
|
:revision => '123',
|
||||||
|
:scmid => '12345',
|
||||||
|
:comments => str)
|
||||||
|
assert( c.save )
|
||||||
if str.respond_to?(:force_encoding)
|
if str.respond_to?(:force_encoding)
|
||||||
assert_equal "Texte encod? en ISO-8859-1.", c.comments
|
assert_equal "Texte encod? en ISO-8859-1.", c.comments
|
||||||
else
|
else
|
||||||
@ -256,7 +271,15 @@ class ChangesetTest < ActiveSupport::TestCase
|
|||||||
s4.force_encoding('UTF-8')
|
s4.force_encoding('UTF-8')
|
||||||
assert_equal s3.encode('UTF-8'), s4
|
assert_equal s3.encode('UTF-8'), s4
|
||||||
end
|
end
|
||||||
c.comments = s1
|
proj = Project.find(3)
|
||||||
|
r = Repository::Bazaar.create!(:project => proj, :url => '/tmp/test/bazaar')
|
||||||
|
assert r
|
||||||
|
c = Changeset.new(:repository => r,
|
||||||
|
:committed_on => Time.now,
|
||||||
|
:revision => '123',
|
||||||
|
:scmid => '12345',
|
||||||
|
:comments => s1)
|
||||||
|
assert( c.save )
|
||||||
assert_equal s2, c.comments
|
assert_equal s2, c.comments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user