##// END OF EJS Templates
scm: mercurial: update test repository for path encoding (#2664)....
Toshi MARUYAMA -
r4876:b7dffa44c92c
parent child
Show More
1 NO CONTENT: modified file, binary diff hidden
@@ -32,7 +32,11 class RepositoriesMercurialControllerTest < ActionController::TestCase
32 32 @request = ActionController::TestRequest.new
33 33 @response = ActionController::TestResponse.new
34 34 User.current = nil
35 @repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH)
35 @repository = Repository::Mercurial.create(
36 :project => Project.find(3),
37 :url => REPOSITORY_PATH,
38 :path_encoding => 'ISO-8859-1'
39 )
36 40 assert @repository
37 41 @diff_c_support = true
38 42 end
@@ -10,10 +10,19 begin
10 10
11 11 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
12 12
13 CHAR_1_HEX = "\xc3\x9c"
14
13 15 if File.directory?(REPOSITORY_PATH)
14 16 def setup
15 17 @adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH)
16 18 @diff_c_support = true
19
20 @tag_char_1 = "tag-#{CHAR_1_HEX}-00"
21 @branch_char_1 = "branch-#{CHAR_1_HEX}-00"
22 if @tag_char_1.respond_to?(:force_encoding)
23 @tag_char_1.force_encoding('UTF-8')
24 @branch_char_1.force_encoding('UTF-8')
25 end
17 26 end
18 27
19 28 def test_hgversion
@@ -49,7 +58,7 begin
49 58 adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo)
50 59 repo_path = adp.info.root_url.gsub(/\\/, "/")
51 60 assert_equal REPOSITORY_PATH, repo_path
52 assert_equal '16', adp.info.lastrev.revision
61 assert_equal '24', adp.info.lastrev.revision
53 62 assert_equal '4cddb4e45f52',adp.info.lastrev.scmid
54 63 end
55 64 end
@@ -97,7 +106,7 begin
97 106
98 107 def test_diff_made_by_revision
99 108 if @diff_c_support
100 [16, '16', '4cddb4e45f52'].each do |r1|
109 [24, '24', '4cddb4e45f52'].each do |r1|
101 110 diff1 = @adapter.diff(nil, r1)
102 111 assert_equal 5, diff1.size
103 112 buf = diff1[4].gsub(/\r\n|\r|\n/, "")
@@ -219,24 +228,32 begin
219 228 end
220 229
221 230 def test_tags
222 assert_equal ['tag_test.00', 'tag-init-revision'], @adapter.tags
231 assert_equal [@tag_char_1, 'tag_test.00', 'tag-init-revision'], @adapter.tags
223 232 end
224 233
225 234 def test_tagmap
226 tm = { 'tag_test.00' => '6987191f453a',
227 'tag-init-revision' => '0885933ad4f6' }
235 tm = {
236 @tag_char_1 => 'adf805632193',
237 'tag_test.00' => '6987191f453a',
238 'tag-init-revision' => '0885933ad4f6',
239 }
228 240 assert_equal tm, @adapter.tagmap
229 241 end
230 242
231 243 def test_branches
232 assert_equal ['default', 'branch (1)[2]&,%.-3_4', 'test-branch-00'],
244 assert_equal ['default', @branch_char_1,
245 'test_branch.latin-1', 'branch (1)[2]&,%.-3_4', 'test-branch-00'],
233 246 @adapter.branches
234 247 end
235 248
236 249 def test_branchmap
237 bm = { 'default' => '4cddb4e45f52',
250 bm = {
251 'default' => '4cddb4e45f52',
252 @branch_char_1 => 'c8d3e4887474',
253 'test_branch.latin-1' => 'c2ffe7da686a',
238 254 'branch (1)[2]&,%.-3_4' => '933ca60293d7',
239 'test-branch-00' => '3a330eb32958' }
255 'test-branch-00' => '3a330eb32958'
256 }
240 257 assert_equal bm, @adapter.branchmap
241 258 end
242 259
@@ -25,7 +25,11 class RepositoryMercurialTest < ActiveSupport::TestCase
25 25
26 26 def setup
27 27 @project = Project.find(3)
28 @repository = Repository::Mercurial.create(:project => @project, :url => REPOSITORY_PATH)
28 @repository = Repository::Mercurial.create(
29 :project => @project,
30 :url => REPOSITORY_PATH,
31 :path_encoding => 'ISO-8859-1'
32 )
29 33 assert @repository
30 34 end
31 35
@@ -33,8 +37,8 class RepositoryMercurialTest < ActiveSupport::TestCase
33 37 def test_fetch_changesets_from_scratch
34 38 @repository.fetch_changesets
35 39 @repository.reload
36 assert_equal 17, @repository.changesets.count
37 assert_equal 25, @repository.changes.count
40 assert_equal 25, @repository.changesets.count
41 assert_equal 32, @repository.changes.count
38 42 assert_equal "Initial import.\nThe repository contains 3 files.",
39 43 @repository.changesets.find_by_revision('0').comments
40 44 end
@@ -47,7 +51,7 class RepositoryMercurialTest < ActiveSupport::TestCase
47 51 assert_equal 3, @repository.changesets.count
48 52
49 53 @repository.fetch_changesets
50 assert_equal 17, @repository.changesets.count
54 assert_equal 25, @repository.changesets.count
51 55 end
52 56
53 57 def test_isodatesec
@@ -170,7 +174,7 class RepositoryMercurialTest < ActiveSupport::TestCase
170 174 @repository.fetch_changesets
171 175 @repository.reload
172 176 changesets = @repository.latest_changesets('README', nil)
173 assert_equal %w|8 6 1 0|, changesets.collect(&:revision)
177 assert_equal %w|17 8 6 1 0|, changesets.collect(&:revision)
174 178
175 179 path = 'sql_escape/percent%dir/percent%file1.txt'
176 180 changesets = @repository.latest_changesets(path, nil)
General Comments 0
You need to be logged in to leave comments. Login now