##// END OF EJS Templates
scm: mercurial: additional unit model tests for path encoding (#2664)....
Toshi MARUYAMA -
r4879:17219baa626d
parent child
Show More
@@ -23,6 +23,8 class RepositoryMercurialTest < ActiveSupport::TestCase
23 # No '..' in the repository path
23 # No '..' in the repository path
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
25
25
26 CHAR_1_HEX = "\xc3\x9c"
27
26 def setup
28 def setup
27 @project = Project.find(3)
29 @project = Project.find(3)
28 @repository = Repository::Mercurial.create(
30 @repository = Repository::Mercurial.create(
@@ -31,6 +33,10 class RepositoryMercurialTest < ActiveSupport::TestCase
31 :path_encoding => 'ISO-8859-1'
33 :path_encoding => 'ISO-8859-1'
32 )
34 )
33 assert @repository
35 assert @repository
36 @char_1 = CHAR_1_HEX.dup
37 if @char_1.respond_to?(:force_encoding)
38 @char_1.force_encoding('UTF-8')
39 end
34 end
40 end
35
41
36 if File.directory?(REPOSITORY_PATH)
42 if File.directory?(REPOSITORY_PATH)
@@ -115,6 +121,13 class RepositoryMercurialTest < ActiveSupport::TestCase
115 assert_equal 'A', c2[0].action
121 assert_equal 'A', c2[0].action
116 assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
122 assert_equal '/README (1)[2]&,%.-3_4', c2[0].path
117 assert_equal '/README', c2[0].from_path
123 assert_equal '/README', c2[0].from_path
124
125 cs3 = @repository.changesets.find_by_revision('19')
126 c3 = cs3.changes
127 assert_equal 1, c3.size
128 assert_equal 'A', c3[0].action
129 assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
130 assert_equal "/latin-1-dir/test-#{@char_1}.txt", c3[0].from_path
118 end
131 end
119
132
120 def test_find_changeset_by_name
133 def test_find_changeset_by_name
General Comments 0
You need to be logged in to leave comments. Login now