Revision 441:cbce1fd3b1b7 test/unit/lib/redmine/scm/adapters/.svn
| test/unit/lib/redmine/scm/adapters/.svn/all-wcprops | ||
|---|---|---|
| 1 |
K 25 |
|
| 2 |
svn:wc:ra_dav:version-url |
|
| 3 |
V 59 |
|
| 4 |
/svn/!svn/ver/4964/trunk/test/unit/lib/redmine/scm/adapters |
|
| 5 |
END |
|
| 6 |
subversion_adapter_test.rb |
|
| 7 |
K 25 |
|
| 8 |
svn:wc:ra_dav:version-url |
|
| 9 |
V 86 |
|
| 10 |
/svn/!svn/ver/4825/trunk/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb |
|
| 11 |
END |
|
| 12 |
bazaar_adapter_test.rb |
|
| 13 |
K 25 |
|
| 14 |
svn:wc:ra_dav:version-url |
|
| 15 |
V 82 |
|
| 16 |
/svn/!svn/ver/4836/trunk/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb |
|
| 17 |
END |
|
| 18 |
git_adapter_test.rb |
|
| 19 |
K 25 |
|
| 20 |
svn:wc:ra_dav:version-url |
|
| 21 |
V 79 |
|
| 22 |
/svn/!svn/ver/4964/trunk/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb |
|
| 23 |
END |
|
| 24 |
mercurial_adapter_test.rb |
|
| 25 |
K 25 |
|
| 26 |
svn:wc:ra_dav:version-url |
|
| 27 |
V 85 |
|
| 28 |
/svn/!svn/ver/4875/trunk/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb |
|
| 29 |
END |
|
| 30 |
filesystem_adapter_test.rb |
|
| 31 |
K 25 |
|
| 32 |
svn:wc:ra_dav:version-url |
|
| 33 |
V 86 |
|
| 34 |
/svn/!svn/ver/4509/trunk/test/unit/lib/redmine/scm/adapters/filesystem_adapter_test.rb |
|
| 35 |
END |
|
| 36 |
cvs_adapter_test.rb |
|
| 37 |
K 25 |
|
| 38 |
svn:wc:ra_dav:version-url |
|
| 39 |
V 79 |
|
| 40 |
/svn/!svn/ver/4832/trunk/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb |
|
| 41 |
END |
|
| 42 |
darcs_adapter_test.rb |
|
| 43 |
K 25 |
|
| 44 |
svn:wc:ra_dav:version-url |
|
| 45 |
V 81 |
|
| 46 |
/svn/!svn/ver/4748/trunk/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb |
|
| 47 |
END |
|
| test/unit/lib/redmine/scm/adapters/.svn/entries | ||
|---|---|---|
| 1 | 1 |
10 |
| 2 | 2 |
|
| 3 | 3 |
dir |
| 4 |
4993
|
|
| 5 |
http://redmine.rubyforge.org/svn/trunk/test/unit/lib/redmine/scm/adapters
|
|
| 4 |
6000
|
|
| 5 |
http://redmine.rubyforge.org/svn/branches/1.2-stable/test/unit/lib/redmine/scm/adapters
|
|
| 6 | 6 |
http://redmine.rubyforge.org/svn |
| 7 | 7 |
|
| 8 | 8 |
|
| 9 | 9 |
|
| 10 |
2011-02-28T14:12:47.115180Z
|
|
| 11 |
4964
|
|
| 10 |
2011-05-21T02:40:19.290757Z
|
|
| 11 |
5871
|
|
| 12 | 12 |
tmaruyama |
| 13 | 13 |
|
| 14 | 14 |
|
| ... | ... | |
| 32 | 32 |
|
| 33 | 33 |
|
| 34 | 34 |
|
| 35 |
2011-03-03T11:40:17.000000Z
|
|
| 36 |
f0de1284b35555e358dcb810fff1e7e5
|
|
| 37 |
2011-02-15T02:12:39.628343Z
|
|
| 38 |
4825
|
|
| 35 |
2011-06-06T13:17:45.000000Z
|
|
| 36 |
f557b1bd1a675ea916f153007ba3b63b
|
|
| 37 |
2011-05-13T06:18:18.001804Z
|
|
| 38 |
5782
|
|
| 39 | 39 |
tmaruyama |
| 40 | 40 |
has-props |
| 41 | 41 |
|
| ... | ... | |
| 58 | 58 |
|
| 59 | 59 |
|
| 60 | 60 |
|
| 61 |
2221
|
|
| 61 |
2171
|
|
| 62 | 62 |
|
| 63 | 63 |
bazaar_adapter_test.rb |
| 64 | 64 |
file |
| ... | ... | |
| 66 | 66 |
|
| 67 | 67 |
|
| 68 | 68 |
|
| 69 |
2011-03-03T11:40:17.000000Z
|
|
| 70 |
2f30e1187cf8e155707fdf3ff7925f55
|
|
| 71 |
2011-02-15T11:05:33.284244Z
|
|
| 72 |
4836
|
|
| 69 |
2011-06-06T13:17:45.000000Z
|
|
| 70 |
ce4b0da1349db40b4d1f5e5c2585b578
|
|
| 71 |
2011-04-25T02:02:44.186808Z
|
|
| 72 |
5547
|
|
| 73 | 73 |
tmaruyama |
| 74 | 74 |
|
| 75 | 75 |
|
| ... | ... | |
| 92 | 92 |
|
| 93 | 93 |
|
| 94 | 94 |
|
| 95 |
1755
|
|
| 95 |
1747
|
|
| 96 | 96 |
|
| 97 | 97 |
git_adapter_test.rb |
| 98 | 98 |
file |
| ... | ... | |
| 100 | 100 |
|
| 101 | 101 |
|
| 102 | 102 |
|
| 103 |
2011-03-03T11:40:17.000000Z
|
|
| 104 |
3d2db23c9a95bf5342365aa4580873c7
|
|
| 105 |
2011-02-28T14:12:47.115180Z
|
|
| 106 |
4964
|
|
| 103 |
2011-06-06T13:17:45.000000Z
|
|
| 104 |
022aa22cafe189955d72292f45719d27
|
|
| 105 |
2011-05-21T02:40:19.290757Z
|
|
| 106 |
5871
|
|
| 107 | 107 |
tmaruyama |
| 108 | 108 |
has-props |
| 109 | 109 |
|
| ... | ... | |
| 126 | 126 |
|
| 127 | 127 |
|
| 128 | 128 |
|
| 129 |
4592
|
|
| 129 |
14511
|
|
| 130 | 130 |
|
| 131 | 131 |
mercurial_adapter_test.rb |
| 132 | 132 |
file |
| ... | ... | |
| 134 | 134 |
|
| 135 | 135 |
|
| 136 | 136 |
|
| 137 |
2011-03-03T11:40:17.000000Z
|
|
| 138 |
20194ed3de36e9107b3279bb4ae596e9
|
|
| 139 |
2011-02-18T07:15:58.762873Z
|
|
| 140 |
4875
|
|
| 137 |
2011-06-06T13:17:45.000000Z
|
|
| 138 |
8b5bb34f0a1bcb7d72c08d8002fdf8c9
|
|
| 139 |
2011-05-21T02:38:56.933725Z
|
|
| 140 |
5869
|
|
| 141 | 141 |
tmaruyama |
| 142 | 142 |
has-props |
| 143 | 143 |
|
| ... | ... | |
| 160 | 160 |
|
| 161 | 161 |
|
| 162 | 162 |
|
| 163 |
10201
|
|
| 163 |
13973
|
|
| 164 | 164 |
|
| 165 | 165 |
filesystem_adapter_test.rb |
| 166 | 166 |
file |
| ... | ... | |
| 168 | 168 |
|
| 169 | 169 |
|
| 170 | 170 |
|
| 171 |
2011-03-03T11:05:08.000000Z
|
|
| 172 |
61cf9f9a3628f6766845641d99adaa83
|
|
| 173 |
2010-12-12T23:24:34.194336Z
|
|
| 174 |
4509
|
|
| 175 |
jbbarth
|
|
| 171 |
2011-06-06T13:17:45.000000Z
|
|
| 172 |
197d39b6a381ea2c7170ffb12e726b07
|
|
| 173 |
2011-05-21T02:18:07.305370Z
|
|
| 174 |
5865
|
|
| 175 |
tmaruyama
|
|
| 176 | 176 |
has-props |
| 177 | 177 |
|
| 178 | 178 |
|
| ... | ... | |
| 194 | 194 |
|
| 195 | 195 |
|
| 196 | 196 |
|
| 197 |
1449
|
|
| 197 |
2071
|
|
| 198 | 198 |
|
| 199 | 199 |
cvs_adapter_test.rb |
| 200 | 200 |
file |
| ... | ... | |
| 202 | 202 |
|
| 203 | 203 |
|
| 204 | 204 |
|
| 205 |
2011-03-03T11:40:17.000000Z
|
|
| 206 |
ddf3ab1a187f29d3e377f684c2c0f18c
|
|
| 207 |
2011-02-15T08:04:11.026838Z
|
|
| 208 |
4832
|
|
| 205 |
2011-06-06T13:17:45.000000Z
|
|
| 206 |
b54bd12ccb2aacffac79b6374356647b
|
|
| 207 |
2011-05-21T02:19:38.840190Z
|
|
| 208 |
5867
|
|
| 209 | 209 |
tmaruyama |
| 210 | 210 |
|
| 211 | 211 |
|
| ... | ... | |
| 228 | 228 |
|
| 229 | 229 |
|
| 230 | 230 |
|
| 231 |
1844
|
|
| 231 |
2835
|
|
| 232 | 232 |
|
| 233 | 233 |
darcs_adapter_test.rb |
| 234 | 234 |
file |
| ... | ... | |
| 236 | 236 |
|
| 237 | 237 |
|
| 238 | 238 |
|
| 239 |
2011-03-03T11:05:08.000000Z
|
|
| 240 |
3a836e9a54b113ed5fe6490ce88ebebe
|
|
| 241 |
2011-01-23T04:17:03.473127Z
|
|
| 242 |
4748
|
|
| 239 |
2011-06-06T13:17:45.000000Z
|
|
| 240 |
21e4028794985d0780acfc26daaf4b6f
|
|
| 241 |
2011-05-13T06:15:57.056758Z
|
|
| 242 |
5779
|
|
| 243 | 243 |
tmaruyama |
| 244 | 244 |
|
| 245 | 245 |
|
| ... | ... | |
| 262 | 262 |
|
| 263 | 263 |
|
| 264 | 264 |
|
| 265 |
1649
|
|
| 265 |
1643
|
|
| 266 | 266 |
|
| test/unit/lib/redmine/scm/adapters/.svn/text-base/bazaar_adapter_test.rb.svn-base | ||
|---|---|---|
| 7 | 7 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
|
| 8 | 8 |
REPOSITORY_PATH.gsub!(/\/+/, '/') |
| 9 | 9 |
|
| 10 |
if File.directory?(REPOSITORY_PATH)
|
|
| 10 |
if File.directory?(REPOSITORY_PATH) |
|
| 11 | 11 |
def setup |
| 12 | 12 |
@adapter = Redmine::Scm::Adapters::BazaarAdapter.new(REPOSITORY_PATH) |
| 13 | 13 |
end |
| ... | ... | |
| 25 | 25 |
cat = @adapter.cat('directory/document.txt')
|
| 26 | 26 |
assert cat =~ /Write the contents of a file as of a given revision to standard output/ |
| 27 | 27 |
end |
| 28 |
|
|
| 28 |
|
|
| 29 | 29 |
def test_annotate |
| 30 | 30 |
annotate = @adapter.annotate('doc-mkdir.txt')
|
| 31 | 31 |
assert_equal 17, annotate.lines.size |
| ... | ... | |
| 45 | 45 |
def test_fake; assert true end |
| 46 | 46 |
end |
| 47 | 47 |
end |
| 48 |
|
|
| 49 | 48 |
rescue LoadError |
| 50 | 49 |
class BazaarMochaFake < ActiveSupport::TestCase |
| 51 | 50 |
def test_fake; assert(false, "Requires mocha to run those tests") end |
| 52 | 51 |
end |
| 53 | 52 |
end |
| 54 |
|
|
| test/unit/lib/redmine/scm/adapters/.svn/text-base/cvs_adapter_test.rb.svn-base | ||
|---|---|---|
| 1 | 1 |
require File.expand_path('../../../../../../test_helper', __FILE__)
|
| 2 | 2 |
begin |
| 3 | 3 |
require 'mocha' |
| 4 |
|
|
| 4 |
|
|
| 5 | 5 |
class CvsAdapterTest < ActiveSupport::TestCase |
| 6 |
|
|
| 6 |
|
|
| 7 | 7 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
|
| 8 | 8 |
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
| 9 | 9 |
MODULE_NAME = 'test' |
| 10 | 10 |
|
| 11 |
if File.directory?(REPOSITORY_PATH)
|
|
| 11 |
if File.directory?(REPOSITORY_PATH) |
|
| 12 | 12 |
def setup |
| 13 | 13 |
@adapter = Redmine::Scm::Adapters::CvsAdapter.new(MODULE_NAME, REPOSITORY_PATH) |
| 14 | 14 |
end |
| ... | ... | |
| 24 | 24 |
|
| 25 | 25 |
def test_revisions_all |
| 26 | 26 |
cnt = 0 |
| 27 |
@adapter.revisions('', nil, nil, :with_paths => true) do |revision|
|
|
| 27 |
@adapter.revisions('', nil, nil, :log_encoding => 'UTF-8') do |revision|
|
|
| 28 | 28 |
cnt += 1 |
| 29 | 29 |
end |
| 30 |
assert_equal 14, cnt
|
|
| 30 |
assert_equal 16, cnt
|
|
| 31 | 31 |
end |
| 32 | 32 |
|
| 33 | 33 |
def test_revisions_from_rev3 |
| 34 | 34 |
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) |
| 35 | 35 |
cnt = 0 |
| 36 |
@adapter.revisions('', rev3_committed_on, nil, :with_paths => true) do |revision|
|
|
| 36 |
@adapter.revisions('', rev3_committed_on, nil, :log_encoding => 'UTF-8') do |revision|
|
|
| 37 | 37 |
cnt += 1 |
| 38 | 38 |
end |
| 39 |
assert_equal 2, cnt |
|
| 39 |
assert_equal 4, cnt |
|
| 40 |
end |
|
| 41 |
|
|
| 42 |
def test_entries_rev3 |
|
| 43 |
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) |
|
| 44 |
entries = @adapter.entries('sources', rev3_committed_on)
|
|
| 45 |
assert_equal 2, entries.size |
|
| 46 |
assert_equal entries[0].name, "watchers_controller.rb" |
|
| 47 |
assert_equal entries[0].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22) |
|
| 48 |
end |
|
| 49 |
|
|
| 50 |
def test_path_encoding_default_utf8 |
|
| 51 |
adpt1 = Redmine::Scm::Adapters::CvsAdapter.new( |
|
| 52 |
MODULE_NAME, |
|
| 53 |
REPOSITORY_PATH |
|
| 54 |
) |
|
| 55 |
assert_equal "UTF-8", adpt1.path_encoding |
|
| 56 |
adpt2 = Redmine::Scm::Adapters::CvsAdapter.new( |
|
| 57 |
MODULE_NAME, |
|
| 58 |
REPOSITORY_PATH, |
|
| 59 |
nil, |
|
| 60 |
nil, |
|
| 61 |
"" |
|
| 62 |
) |
|
| 63 |
assert_equal "UTF-8", adpt2.path_encoding |
|
| 40 | 64 |
end |
| 41 | 65 |
|
| 42 | 66 |
private |
| test/unit/lib/redmine/scm/adapters/.svn/text-base/darcs_adapter_test.rb.svn-base | ||
|---|---|---|
| 1 | 1 |
require File.expand_path('../../../../../../test_helper', __FILE__)
|
| 2 | 2 |
begin |
| 3 | 3 |
require 'mocha' |
| 4 |
|
|
| 4 |
|
|
| 5 | 5 |
class DarcsAdapterTest < ActiveSupport::TestCase |
| 6 |
|
|
| 6 |
|
|
| 7 | 7 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository'
|
| 8 | 8 |
|
| 9 | 9 |
if File.directory?(REPOSITORY_PATH) |
| test/unit/lib/redmine/scm/adapters/.svn/text-base/filesystem_adapter_test.rb.svn-base | ||
|---|---|---|
| 1 | 1 |
|
| 2 | 2 |
require File.expand_path('../../../../../../test_helper', __FILE__)
|
| 3 | 3 |
|
| 4 |
class FilesystemAdapterTest < ActiveSupport::TestCase |
|
| 4 | 5 |
|
| 5 |
class FilesystemAdapterTest < ActiveSupport::TestCase |
|
| 6 |
|
|
| 7 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
|
|
| 8 |
|
|
| 9 |
if File.directory?(REPOSITORY_PATH) |
|
| 6 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository'
|
|
| 7 |
|
|
| 8 |
if File.directory?(REPOSITORY_PATH) |
|
| 10 | 9 |
def setup |
| 11 | 10 |
@adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH) |
| 12 | 11 |
end |
| 13 |
|
|
| 12 |
|
|
| 14 | 13 |
def test_entries |
| 15 |
assert_equal 2, @adapter.entries.size
|
|
| 16 |
assert_equal ["dir", "test"], @adapter.entries.collect(&:name) |
|
| 17 |
assert_equal ["dir", "test"], @adapter.entries(nil).collect(&:name) |
|
| 18 |
assert_equal ["dir", "test"], @adapter.entries("/").collect(&:name)
|
|
| 14 |
assert_equal 3, @adapter.entries.size
|
|
| 15 |
assert_equal ["dir", "japanese", "test"], @adapter.entries.collect(&:name)
|
|
| 16 |
assert_equal ["dir", "japanese", "test"], @adapter.entries(nil).collect(&:name)
|
|
| 17 |
assert_equal ["dir", "japanese", "test"], @adapter.entries("/").collect(&:name)
|
|
| 19 | 18 |
["dir", "/dir", "/dir/", "dir/"].each do |path| |
| 20 | 19 |
assert_equal ["subdir", "dirfile"], @adapter.entries(path).collect(&:name) |
| 21 | 20 |
end |
| 22 | 21 |
# If y try to use "..", the path is ignored |
| 23 | 22 |
["/../","dir/../", "..", "../", "/..", "dir/.."].each do |path| |
| 24 |
assert_equal ["dir", "test"], @adapter.entries(path).collect(&:name), ".. must be ignored in path argument" |
|
| 23 |
assert_equal ["dir", "japanese", "test"], @adapter.entries(path).collect(&:name), |
|
| 24 |
".. must be ignored in path argument" |
|
| 25 | 25 |
end |
| 26 | 26 |
end |
| 27 |
|
|
| 27 |
|
|
| 28 | 28 |
def test_cat |
| 29 | 29 |
assert_equal "TEST CAT\n", @adapter.cat("test")
|
| 30 | 30 |
assert_equal "TEST CAT\n", @adapter.cat("/test")
|
| 31 | 31 |
# Revision number is ignored |
| 32 | 32 |
assert_equal "TEST CAT\n", @adapter.cat("/test", 1)
|
| 33 | 33 |
end |
| 34 |
|
|
| 34 |
|
|
| 35 |
def test_path_encoding_default_utf8 |
|
| 36 |
adpt1 = Redmine::Scm::Adapters::FilesystemAdapter.new( |
|
| 37 |
REPOSITORY_PATH |
|
| 38 |
) |
|
| 39 |
assert_equal "UTF-8", adpt1.path_encoding |
|
| 40 |
adpt2 = Redmine::Scm::Adapters::FilesystemAdapter.new( |
|
| 41 |
REPOSITORY_PATH, |
|
| 42 |
nil, |
|
| 43 |
nil, |
|
| 44 |
nil, |
|
| 45 |
"" |
|
| 46 |
) |
|
| 47 |
assert_equal "UTF-8", adpt2.path_encoding |
|
| 48 |
end |
|
| 35 | 49 |
else |
| 36 | 50 |
puts "Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS." |
| 37 | 51 |
def test_fake; assert true end |
| 38 | 52 |
end |
| 39 |
|
|
| 40 | 53 |
end |
| 41 |
|
|
| 42 |
|
|
| test/unit/lib/redmine/scm/adapters/.svn/text-base/git_adapter_test.rb.svn-base | ||
|---|---|---|
| 12 | 12 |
|
| 13 | 13 |
FELIX_UTF8 = "Felix Schäfer" |
| 14 | 14 |
FELIX_HEX = "Felix Sch\xC3\xA4fer" |
| 15 |
CHAR_1_HEX = "\xc3\x9c" |
|
| 16 |
|
|
| 17 |
## Ruby uses ANSI api to fork a process on Windows. |
|
| 18 |
## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem |
|
| 19 |
## and these are incompatible with ASCII. |
|
| 20 |
# WINDOWS_PASS = Redmine::Platform.mswin? |
|
| 21 |
WINDOWS_PASS = false |
|
| 15 | 22 |
|
| 16 | 23 |
if File.directory?(REPOSITORY_PATH) |
| 17 | 24 |
def setup |
| 18 |
@adapter = Redmine::Scm::Adapters::GitAdapter.new(REPOSITORY_PATH) |
|
| 25 |
adapter_class = Redmine::Scm::Adapters::GitAdapter |
|
| 26 |
assert adapter_class |
|
| 27 |
assert adapter_class.client_command |
|
| 28 |
assert_equal true, adapter_class.client_available |
|
| 29 |
assert_equal true, adapter_class.client_version_above?([1]) |
|
| 30 |
assert_equal true, adapter_class.client_version_above?([1, 0]) |
|
| 31 |
|
|
| 32 |
@adapter = Redmine::Scm::Adapters::GitAdapter.new( |
|
| 33 |
REPOSITORY_PATH, |
|
| 34 |
nil, |
|
| 35 |
nil, |
|
| 36 |
nil, |
|
| 37 |
'ISO-8859-1' |
|
| 38 |
) |
|
| 39 |
assert @adapter |
|
| 40 |
@char_1 = CHAR_1_HEX.dup |
|
| 41 |
if @char_1.respond_to?(:force_encoding) |
|
| 42 |
@char_1.force_encoding('UTF-8')
|
|
| 43 |
end |
|
| 19 | 44 |
end |
| 20 | 45 |
|
| 21 | 46 |
def test_scm_version |
| ... | ... | |
| 28 | 53 |
end |
| 29 | 54 |
|
| 30 | 55 |
def test_branches |
| 31 |
assert_equal @adapter.branches, ['master', 'test-latin-1', 'test_branch'] |
|
| 56 |
assert_equal [ |
|
| 57 |
'latin-1-path-encoding', |
|
| 58 |
'master', |
|
| 59 |
'test-latin-1', |
|
| 60 |
'test_branch', |
|
| 61 |
], @adapter.branches |
|
| 62 |
end |
|
| 63 |
|
|
| 64 |
def test_tags |
|
| 65 |
assert_equal [ |
|
| 66 |
"tag00.lightweight", |
|
| 67 |
"tag01.annotated", |
|
| 68 |
], @adapter.tags |
|
| 32 | 69 |
end |
| 33 | 70 |
|
| 34 | 71 |
def test_getting_all_revisions |
| 35 |
assert_equal 16, @adapter.revisions('',nil,nil,:all => true).length
|
|
| 72 |
assert_equal 21, @adapter.revisions('',nil,nil,:all => true).length
|
|
| 36 | 73 |
end |
| 37 | 74 |
|
| 38 | 75 |
def test_getting_certain_revisions |
| 39 | 76 |
assert_equal 1, @adapter.revisions('','899a15d^','899a15d').length
|
| 40 | 77 |
end |
| 41 | 78 |
|
| 79 |
def test_revisions_reverse |
|
| 80 |
revs1 = @adapter.revisions('',nil,nil,{:all => true, :reverse => true })
|
|
| 81 |
assert_equal 21, revs1.length |
|
| 82 |
assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[0].identifier |
|
| 83 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs1[20].identifier |
|
| 84 |
end |
|
| 85 |
|
|
| 86 |
def test_revisions_reverse_with_time |
|
| 87 |
since2 = Time.gm(2010, 9, 30, 0, 0, 0) |
|
| 88 |
revs2 = @adapter.revisions('', nil, nil,
|
|
| 89 |
{:all => true, :since => since2, :reverse => true})
|
|
| 90 |
assert_equal 6, revs2.length |
|
| 91 |
assert_equal '67e7792ce20ccae2e4bb73eed09bb397819c8834', revs2[0].identifier |
|
| 92 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs2[5].identifier |
|
| 93 |
end |
|
| 94 |
|
|
| 95 |
def test_revisions_master_all |
|
| 96 |
revs1 = [] |
|
| 97 |
@adapter.revisions('', nil, "master",{}) do |rev|
|
|
| 98 |
revs1 << rev |
|
| 99 |
end |
|
| 100 |
assert_equal 15, revs1.length |
|
| 101 |
assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[ 0].identifier |
|
| 102 |
assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[-1].identifier |
|
| 103 |
|
|
| 104 |
revs2 = [] |
|
| 105 |
@adapter.revisions('', nil, "master",
|
|
| 106 |
{:reverse => true}) do |rev|
|
|
| 107 |
revs2 << rev |
|
| 108 |
end |
|
| 109 |
assert_equal 15, revs2.length |
|
| 110 |
assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier |
|
| 111 |
assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs2[ 0].identifier |
|
| 112 |
end |
|
| 113 |
|
|
| 114 |
def test_revisions_master_merged_rev |
|
| 115 |
revs1 = [] |
|
| 116 |
@adapter.revisions('',
|
|
| 117 |
"713f4944648826f558cf548222f813dabe7cbb04", |
|
| 118 |
"master", |
|
| 119 |
{:reverse => true}) do |rev|
|
|
| 120 |
revs1 << rev |
|
| 121 |
end |
|
| 122 |
assert_equal 8, revs1.length |
|
| 123 |
assert_equal 'fba357b886984ee71185ad2065e65fc0417d9b92', revs1[ 0].identifier |
|
| 124 |
assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs1[ 1].identifier |
|
| 125 |
# 4a07fe31b is not a child of 713f49446 |
|
| 126 |
assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs1[ 2].identifier |
|
| 127 |
# Merged revision |
|
| 128 |
assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs1[ 3].identifier |
|
| 129 |
assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[-1].identifier |
|
| 130 |
|
|
| 131 |
revs2 = [] |
|
| 132 |
@adapter.revisions('',
|
|
| 133 |
"fba357b886984ee71185ad2065e65fc0417d9b92", |
|
| 134 |
"master", |
|
| 135 |
{:reverse => true}) do |rev|
|
|
| 136 |
revs2 << rev |
|
| 137 |
end |
|
| 138 |
assert_equal 7, revs2.length |
|
| 139 |
assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs2[ 0].identifier |
|
| 140 |
# 4a07fe31b is not a child of fba357b8869 |
|
| 141 |
assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs2[ 1].identifier |
|
| 142 |
# Merged revision |
|
| 143 |
assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs2[ 2].identifier |
|
| 144 |
assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier |
|
| 145 |
end |
|
| 146 |
|
|
| 147 |
def test_revisions_branch_latin_1_path_encoding_all |
|
| 148 |
revs1 = [] |
|
| 149 |
@adapter.revisions('', nil, "latin-1-path-encoding",{}) do |rev|
|
|
| 150 |
revs1 << rev |
|
| 151 |
end |
|
| 152 |
assert_equal 8, revs1.length |
|
| 153 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs1[ 0].identifier |
|
| 154 |
assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[-1].identifier |
|
| 155 |
|
|
| 156 |
revs2 = [] |
|
| 157 |
@adapter.revisions('', nil, "latin-1-path-encoding",
|
|
| 158 |
{:reverse => true}) do |rev|
|
|
| 159 |
revs2 << rev |
|
| 160 |
end |
|
| 161 |
assert_equal 8, revs2.length |
|
| 162 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs2[-1].identifier |
|
| 163 |
assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs2[ 0].identifier |
|
| 164 |
end |
|
| 165 |
|
|
| 166 |
def test_revisions_branch_latin_1_path_encoding_with_rev |
|
| 167 |
revs1 = [] |
|
| 168 |
@adapter.revisions('',
|
|
| 169 |
'7234cb2750b63f47bff735edc50a1c0a433c2518', |
|
| 170 |
"latin-1-path-encoding", |
|
| 171 |
{:reverse => true}) do |rev|
|
|
| 172 |
revs1 << rev |
|
| 173 |
end |
|
| 174 |
assert_equal 7, revs1.length |
|
| 175 |
assert_equal '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', revs1[ 0].identifier |
|
| 176 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs1[-1].identifier |
|
| 177 |
|
|
| 178 |
revs2 = [] |
|
| 179 |
@adapter.revisions('',
|
|
| 180 |
'57ca437c0acbbcb749821fdf3726a1367056d364', |
|
| 181 |
"latin-1-path-encoding", |
|
| 182 |
{:reverse => true}) do |rev|
|
|
| 183 |
revs2 << rev |
|
| 184 |
end |
|
| 185 |
assert_equal 3, revs2.length |
|
| 186 |
assert_equal '4fc55c43bf3d3dc2efb66145365ddc17639ce81e', revs2[ 0].identifier |
|
| 187 |
assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', revs2[-1].identifier |
|
| 188 |
end |
|
| 189 |
|
|
| 190 |
def test_revisions_invalid_rev |
|
| 191 |
revs1 = [] |
|
| 192 |
@adapter.revisions('',
|
|
| 193 |
'1234abcd', |
|
| 194 |
"master", |
|
| 195 |
{:reverse => true}) do |rev|
|
|
| 196 |
revs1 << rev |
|
| 197 |
end |
|
| 198 |
assert_equal [], revs1 |
|
| 199 |
end |
|
| 200 |
|
|
| 42 | 201 |
def test_getting_revisions_with_spaces_in_filename |
| 43 | 202 |
assert_equal 1, @adapter.revisions("filemane with spaces.txt",
|
| 44 | 203 |
nil, nil, :all => true).length |
| ... | ... | |
| 60 | 219 |
annotate = @adapter.annotate('sources/watchers_controller.rb')
|
| 61 | 220 |
assert_kind_of Redmine::Scm::Adapters::Annotate, annotate |
| 62 | 221 |
assert_equal 41, annotate.lines.size |
| 63 |
assert_equal "# This program is free software; you can redistribute it and/or", annotate.lines[4].strip |
|
| 222 |
assert_equal "# This program is free software; you can redistribute it and/or", |
|
| 223 |
annotate.lines[4].strip |
|
| 64 | 224 |
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", |
| 65 | 225 |
annotate.revisions[4].identifier |
| 66 | 226 |
assert_equal "jsmith", annotate.revisions[4].author |
| ... | ... | |
| 84 | 244 |
def test_last_rev_with_spaces_in_filename |
| 85 | 245 |
last_rev = @adapter.lastrev("filemane with spaces.txt",
|
| 86 | 246 |
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b") |
| 87 |
str_felix_utf8 = FELIX_UTF8 |
|
| 88 |
str_felix_hex = FELIX_HEX |
|
| 247 |
str_felix_utf8 = FELIX_UTF8.dup
|
|
| 248 |
str_felix_hex = FELIX_HEX.dup
|
|
| 89 | 249 |
last_rev_author = last_rev.author |
| 90 | 250 |
if last_rev_author.respond_to?(:force_encoding) |
| 91 | 251 |
last_rev_author.force_encoding('UTF-8')
|
| ... | ... | |
| 99 | 259 |
assert_equal "2010-09-18 19:59:46".to_time, last_rev.time |
| 100 | 260 |
end |
| 101 | 261 |
|
| 262 |
def test_latin_1_path |
|
| 263 |
if WINDOWS_PASS |
|
| 264 |
# |
|
| 265 |
else |
|
| 266 |
p2 = "latin-1-dir/test-#{@char_1}-2.txt"
|
|
| 267 |
['4fc55c43bf3d3dc2efb66145365ddc17639ce81e', '4fc55c43bf3'].each do |r1| |
|
| 268 |
assert @adapter.diff(p2, r1) |
|
| 269 |
assert @adapter.cat(p2, r1) |
|
| 270 |
assert_equal 1, @adapter.annotate(p2, r1).lines.length |
|
| 271 |
['64f1f3e89ad1cb57976ff0ad99a107012ba3481d', '64f1f3e89ad1cb5797'].each do |r2| |
|
| 272 |
assert @adapter.diff(p2, r1, r2) |
|
| 273 |
end |
|
| 274 |
end |
|
| 275 |
end |
|
| 276 |
end |
|
| 277 |
|
|
| 278 |
def test_entries_tag |
|
| 279 |
entries1 = @adapter.entries(nil, 'tag01.annotated', |
|
| 280 |
options = {:report_last_commit => true})
|
|
| 281 |
assert entries1 |
|
| 282 |
assert_equal 3, entries1.size |
|
| 283 |
assert_equal 'sources', entries1[1].name |
|
| 284 |
assert_equal 'sources', entries1[1].path |
|
| 285 |
assert_equal 'dir', entries1[1].kind |
|
| 286 |
readme = entries1[2] |
|
| 287 |
assert_equal 'README', readme.name |
|
| 288 |
assert_equal 'README', readme.path |
|
| 289 |
assert_equal 'file', readme.kind |
|
| 290 |
assert_equal 27, readme.size |
|
| 291 |
assert_equal '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', readme.lastrev.identifier |
|
| 292 |
assert_equal Time.gm(2007, 12, 14, 9, 24, 1), readme.lastrev.time |
|
| 293 |
end |
|
| 294 |
|
|
| 295 |
def test_entries_branch |
|
| 296 |
entries1 = @adapter.entries(nil, 'test_branch', |
|
| 297 |
options = {:report_last_commit => true})
|
|
| 298 |
assert entries1 |
|
| 299 |
assert_equal 4, entries1.size |
|
| 300 |
assert_equal 'sources', entries1[1].name |
|
| 301 |
assert_equal 'sources', entries1[1].path |
|
| 302 |
assert_equal 'dir', entries1[1].kind |
|
| 303 |
readme = entries1[2] |
|
| 304 |
assert_equal 'README', readme.name |
|
| 305 |
assert_equal 'README', readme.path |
|
| 306 |
assert_equal 'file', readme.kind |
|
| 307 |
assert_equal 159, readme.size |
|
| 308 |
assert_equal '713f4944648826f558cf548222f813dabe7cbb04', readme.lastrev.identifier |
|
| 309 |
assert_equal Time.gm(2009, 6, 19, 4, 37, 23), readme.lastrev.time |
|
| 310 |
end |
|
| 311 |
|
|
| 312 |
def test_entries_latin_1_files |
|
| 313 |
entries1 = @adapter.entries('latin-1-dir', '64f1f3e8')
|
|
| 314 |
assert entries1 |
|
| 315 |
assert_equal 3, entries1.size |
|
| 316 |
f1 = entries1[1] |
|
| 317 |
assert_equal "test-#{@char_1}-2.txt", f1.name
|
|
| 318 |
assert_equal "latin-1-dir/test-#{@char_1}-2.txt", f1.path
|
|
| 319 |
assert_equal 'file', f1.kind |
|
| 320 |
end |
|
| 321 |
|
|
| 322 |
def test_entries_latin_1_dir |
|
| 323 |
if WINDOWS_PASS |
|
| 324 |
# |
|
| 325 |
else |
|
| 326 |
entries1 = @adapter.entries("latin-1-dir/test-#{@char_1}-subdir",
|
|
| 327 |
'1ca7f5ed') |
|
| 328 |
assert entries1 |
|
| 329 |
assert_equal 3, entries1.size |
|
| 330 |
f1 = entries1[1] |
|
| 331 |
assert_equal "test-#{@char_1}-2.txt", f1.name
|
|
| 332 |
assert_equal "latin-1-dir/test-#{@char_1}-subdir/test-#{@char_1}-2.txt", f1.path
|
|
| 333 |
assert_equal 'file', f1.kind |
|
| 334 |
end |
|
| 335 |
end |
|
| 336 |
|
|
| 337 |
def test_path_encoding_default_utf8 |
|
| 338 |
adpt1 = Redmine::Scm::Adapters::GitAdapter.new( |
|
| 339 |
REPOSITORY_PATH |
|
| 340 |
) |
|
| 341 |
assert_equal "UTF-8", adpt1.path_encoding |
|
| 342 |
adpt2 = Redmine::Scm::Adapters::GitAdapter.new( |
|
| 343 |
REPOSITORY_PATH, |
|
| 344 |
nil, |
|
| 345 |
nil, |
|
| 346 |
nil, |
|
| 347 |
"" |
|
| 348 |
) |
|
| 349 |
assert_equal "UTF-8", adpt2.path_encoding |
|
| 350 |
end |
|
| 351 |
|
|
| 102 | 352 |
private |
| 103 | 353 |
|
| 104 | 354 |
def test_scm_version_for(scm_command_version, version) |
| ... | ... | |
| 117 | 367 |
def test_fake; assert(false, "Requires mocha to run those tests") end |
| 118 | 368 |
end |
| 119 | 369 |
end |
| 120 |
|
|
| test/unit/lib/redmine/scm/adapters/.svn/text-base/mercurial_adapter_test.rb.svn-base | ||
|---|---|---|
| 4 | 4 |
|
| 5 | 5 |
class MercurialAdapterTest < ActiveSupport::TestCase |
| 6 | 6 |
|
| 7 |
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR |
|
| 8 |
TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME |
|
| 7 |
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR
|
|
| 8 |
TEMPLATE_NAME = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_NAME
|
|
| 9 | 9 |
TEMPLATE_EXTENSION = Redmine::Scm::Adapters::MercurialAdapter::TEMPLATE_EXTENSION |
| 10 | 10 |
|
| 11 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository'
|
|
| 11 |
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') +
|
|
| 12 |
'/tmp/test/mercurial_repository' |
|
| 13 |
|
|
| 14 |
CHAR_1_HEX = "\xc3\x9c" |
|
| 12 | 15 |
|
| 13 | 16 |
if File.directory?(REPOSITORY_PATH) |
| 14 | 17 |
def setup |
| 15 |
@adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH) |
|
| 18 |
adapter_class = Redmine::Scm::Adapters::MercurialAdapter |
|
| 19 |
assert adapter_class |
|
| 20 |
assert adapter_class.client_command |
|
| 21 |
assert_equal true, adapter_class.client_available |
|
| 22 |
assert_equal true, adapter_class.client_version_above?([0, 9, 5]) |
|
| 23 |
|
|
| 24 |
@adapter = Redmine::Scm::Adapters::MercurialAdapter.new( |
|
| 25 |
REPOSITORY_PATH, |
|
| 26 |
nil, |
|
| 27 |
nil, |
|
| 28 |
nil, |
|
| 29 |
'ISO-8859-1') |
|
| 16 | 30 |
@diff_c_support = true |
| 31 |
@char_1 = CHAR_1_HEX.dup |
|
| 32 |
@tag_char_1 = "tag-#{CHAR_1_HEX}-00"
|
|
| 33 |
@branch_char_0 = "branch-#{CHAR_1_HEX}-00"
|
|
| 34 |
@branch_char_1 = "branch-#{CHAR_1_HEX}-01"
|
|
| 35 |
if @tag_char_1.respond_to?(:force_encoding) |
|
| 36 |
@char_1.force_encoding('UTF-8')
|
|
| 37 |
@tag_char_1.force_encoding('UTF-8')
|
|
| 38 |
@branch_char_0.force_encoding('UTF-8')
|
|
| 39 |
@branch_char_1.force_encoding('UTF-8')
|
|
| 40 |
end |
|
| 17 | 41 |
end |
| 18 | 42 |
|
| 19 | 43 |
def test_hgversion |
| ... | ... | |
| 49 | 73 |
adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo) |
| 50 | 74 |
repo_path = adp.info.root_url.gsub(/\\/, "/") |
| 51 | 75 |
assert_equal REPOSITORY_PATH, repo_path |
| 52 |
assert_equal '16', adp.info.lastrev.revision
|
|
| 53 |
assert_equal '4cddb4e45f52',adp.info.lastrev.scmid
|
|
| 76 |
assert_equal '28', adp.info.lastrev.revision
|
|
| 77 |
assert_equal '3ae45e2d177d',adp.info.lastrev.scmid
|
|
| 54 | 78 |
end |
| 55 | 79 |
end |
| 56 | 80 |
|
| ... | ... | |
| 97 | 121 |
|
| 98 | 122 |
def test_diff_made_by_revision |
| 99 | 123 |
if @diff_c_support |
| 100 |
[16, '16', '4cddb4e45f52'].each do |r1|
|
|
| 124 |
[24, '24', '4cddb4e45f52'].each do |r1|
|
|
| 101 | 125 |
diff1 = @adapter.diff(nil, r1) |
| 102 | 126 |
assert_equal 5, diff1.size |
| 103 | 127 |
buf = diff1[4].gsub(/\r\n|\r|\n/, "") |
| ... | ... | |
| 219 | 243 |
end |
| 220 | 244 |
|
| 221 | 245 |
def test_tags |
| 222 |
assert_equal ['tag_test.00', 'tag-init-revision'], @adapter.tags |
|
| 246 |
assert_equal [@tag_char_1, 'tag_test.00', 'tag-init-revision'], @adapter.tags
|
|
| 223 | 247 |
end |
| 224 | 248 |
|
| 225 | 249 |
def test_tagmap |
| 226 |
tm = { 'tag_test.00' => '6987191f453a',
|
|
| 227 |
'tag-init-revision' => '0885933ad4f6' } |
|
| 250 |
tm = {
|
|
| 251 |
@tag_char_1 => 'adf805632193', |
|
| 252 |
'tag_test.00' => '6987191f453a', |
|
| 253 |
'tag-init-revision' => '0885933ad4f6', |
|
| 254 |
} |
|
| 228 | 255 |
assert_equal tm, @adapter.tagmap |
| 229 | 256 |
end |
| 230 | 257 |
|
| 231 | 258 |
def test_branches |
| 232 |
assert_equal ['default', 'branch (1)[2]&,%.-3_4', 'test-branch-00'], |
|
| 233 |
@adapter.branches |
|
| 259 |
assert_equal [ |
|
| 260 |
'default', |
|
| 261 |
@branch_char_1, |
|
| 262 |
'branch (1)[2]&,%.-3_4', |
|
| 263 |
@branch_char_0, |
|
| 264 |
'test_branch.latin-1', |
|
| 265 |
'test-branch-00', |
|
| 266 |
], @adapter.branches |
|
| 234 | 267 |
end |
| 235 | 268 |
|
| 236 | 269 |
def test_branchmap |
| 237 |
bm = { 'default' => '4cddb4e45f52',
|
|
| 238 |
'branch (1)[2]&,%.-3_4' => '933ca60293d7', |
|
| 239 |
'test-branch-00' => '3a330eb32958' } |
|
| 270 |
bm = {
|
|
| 271 |
'default' => '3ae45e2d177d', |
|
| 272 |
'test_branch.latin-1' => 'c2ffe7da686a', |
|
| 273 |
'branch (1)[2]&,%.-3_4' => 'afc61e85bde7', |
|
| 274 |
'test-branch-00' => '3a330eb32958', |
|
| 275 |
@branch_char_0 => 'c8d3e4887474', |
|
| 276 |
@branch_char_1 => '7bbf4c738e71', |
|
| 277 |
} |
|
| 240 | 278 |
assert_equal bm, @adapter.branchmap |
| 241 | 279 |
end |
| 242 | 280 |
|
| 281 |
def test_path_space |
|
| 282 |
p = 'README (1)[2]&,%.-3_4' |
|
| 283 |
[15, '933ca60293d7'].each do |r1| |
|
| 284 |
assert @adapter.diff(p, r1) |
|
| 285 |
assert @adapter.cat(p, r1) |
|
| 286 |
assert_equal 1, @adapter.annotate(p, r1).lines.length |
|
| 287 |
[25, 'afc61e85bde7'].each do |r2| |
|
| 288 |
assert @adapter.diff(p, r1, r2) |
|
| 289 |
end |
|
| 290 |
end |
|
| 291 |
end |
|
| 292 |
|
|
| 293 |
def test_tag_non_ascii |
|
| 294 |
p = "latin-1-dir/test-#{@char_1}-1.txt"
|
|
| 295 |
assert @adapter.cat(p, @tag_char_1) |
|
| 296 |
assert_equal 1, @adapter.annotate(p, @tag_char_1).lines.length |
|
| 297 |
end |
|
| 298 |
|
|
| 299 |
def test_branch_non_ascii |
|
| 300 |
p = "latin-1-dir/test-#{@char_1}-subdir/test-#{@char_1}-1.txt"
|
|
| 301 |
assert @adapter.cat(p, @branch_char_1) |
|
| 302 |
assert_equal 1, @adapter.annotate(p, @branch_char_1).lines.length |
|
| 303 |
end |
|
| 304 |
|
|
| 305 |
def test_nodes_in_branch |
|
| 306 |
[ |
|
| 307 |
'default', |
|
| 308 |
@branch_char_1, |
|
| 309 |
'branch (1)[2]&,%.-3_4', |
|
| 310 |
@branch_char_0, |
|
| 311 |
'test_branch.latin-1', |
|
| 312 |
'test-branch-00', |
|
| 313 |
].each do |bra| |
|
| 314 |
nib0 = @adapter.nodes_in_branch(bra) |
|
| 315 |
assert nib0 |
|
| 316 |
nib1 = @adapter.nodes_in_branch(bra, :limit => 1) |
|
| 317 |
assert_equal 1, nib1.size |
|
| 318 |
case bra |
|
| 319 |
when 'branch (1)[2]&,%.-3_4' |
|
| 320 |
assert_equal 3, nib0.size |
|
| 321 |
assert_equal nib0[0], 'afc61e85bde7' |
|
| 322 |
nib2 = @adapter.nodes_in_branch(bra, :limit => 2) |
|
| 323 |
assert_equal 2, nib2.size |
|
| 324 |
assert_equal nib2[1], '933ca60293d7' |
|
| 325 |
when @branch_char_1 |
|
| 326 |
assert_equal 2, nib0.size |
|
| 327 |
assert_equal nib0[1], '08ff3227303e' |
|
| 328 |
nib2 = @adapter.nodes_in_branch(bra, :limit => 1) |
|
| 329 |
assert_equal 1, nib2.size |
|
| 330 |
assert_equal nib2[0], '7bbf4c738e71' |
|
| 331 |
end |
|
| 332 |
end |
|
| 333 |
end |
|
| 334 |
|
|
| 335 |
def test_path_encoding_default_utf8 |
|
| 336 |
adpt1 = Redmine::Scm::Adapters::MercurialAdapter.new( |
|
| 337 |
REPOSITORY_PATH |
|
| 338 |
) |
|
| 339 |
assert_equal "UTF-8", adpt1.path_encoding |
|
| 340 |
adpt2 = Redmine::Scm::Adapters::MercurialAdapter.new( |
|
| 341 |
REPOSITORY_PATH, |
|
| 342 |
nil, |
|
| 343 |
nil, |
|
| 344 |
nil, |
|
| 345 |
"" |
|
| 346 |
) |
|
| 347 |
assert_equal "UTF-8", adpt2.path_encoding |
|
| 348 |
end |
|
| 349 |
|
|
| 243 | 350 |
private |
| 244 | 351 |
|
| 245 | 352 |
def test_hgversion_for(hgversion, version) |
| ... | ... | |
| 257 | 364 |
def test_fake; assert true end |
| 258 | 365 |
end |
| 259 | 366 |
end |
| 260 |
|
|
| 261 | 367 |
rescue LoadError |
| 262 | 368 |
class MercurialMochaFake < ActiveSupport::TestCase |
| 263 | 369 |
def test_fake; assert(false, "Requires mocha to run those tests") end |
| 264 | 370 |
end |
| 265 | 371 |
end |
| 266 |
|
|
| test/unit/lib/redmine/scm/adapters/.svn/text-base/subversion_adapter_test.rb.svn-base | ||
|---|---|---|
| 1 |
# redMine - project management software
|
|
| 2 |
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
|
| 1 |
# Redmine - project management software
|
|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| 6 | 6 |
# as published by the Free Software Foundation; either version 2 |
| 7 | 7 |
# of the License, or (at your option) any later version. |
| 8 |
#
|
|
| 8 |
# |
|
| 9 | 9 |
# This program is distributed in the hope that it will be useful, |
| 10 | 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | 12 |
# GNU General Public License for more details. |
| 13 |
#
|
|
| 13 |
# |
|
| 14 | 14 |
# You should have received a copy of the GNU General Public License |
| 15 | 15 |
# along with this program; if not, write to the Free Software |
| 16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| ... | ... | |
| 21 | 21 |
require 'mocha' |
| 22 | 22 |
|
| 23 | 23 |
class SubversionAdapterTest < ActiveSupport::TestCase |
| 24 |
|
|
| 24 |
|
|
| 25 | 25 |
if repository_configured?('subversion')
|
| 26 | 26 |
def setup |
| 27 |
repo_path = "file://#{self.class.repository_path('subversion')}"
|
|
| 28 |
@adapter = Redmine::Scm::Adapters::SubversionAdapter.new(repo_path) |
|
| 27 |
@adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url) |
|
| 29 | 28 |
end |
| 30 | 29 |
|
| 31 | 30 |
def test_client_version |
Also available in: Unified diff