summaryrefslogtreecommitdiffstats
path: root/test/unit/changeset_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 08:07:22 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 08:07:22 +0000
commit1104c3900c7de033f26967af77a36bb8c8993a97 (patch)
treef0a8a9346b3a131c645e0d2ad537fdca0c3452a4 /test/unit/changeset_test.rb
parentc711ead46ca757e996fb17a4f5d7780934eaa559 (diff)
downloadredmine-1104c3900c7de033f26967af77a36bb8c8993a97.tar.gz
redmine-1104c3900c7de033f26967af77a36bb8c8993a97.zip
scm: fix log converting error in Ruby 1.9 and add more tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5370 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/changeset_test.rb')
-rw-r--r--test/unit/changeset_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 95f45379e..93027d849 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -272,6 +272,30 @@ class ChangesetTest < ActiveSupport::TestCase
end
end
+ def test_invalid_utf8_sequences_in_comments_should_be_stripped_ja_jis
+ proj = Project.find(3)
+ str = "test\xb5\xfetest\xb5\xfe"
+ if str.respond_to?(:force_encoding)
+ str.force_encoding('ASCII-8BIT')
+ end
+ r = Repository::Bazaar.create!(
+ :project => proj,
+ :url => '/tmp/test/bazaar',
+ :log_encoding => 'ISO-2022-JP' )
+ 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)
+ assert_equal "test??test??", c.comments
+ else
+ assert_equal "testtest", c.comments
+ end
+ end
+
def test_comments_should_be_converted_all_latin1_to_utf8
s1 = "\xC2\x80"
s2 = "\xc3\x82\xc2\x80"