To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / unit / .svn / text-base / repository_git_test.rb.svn-base @ 441:cbce1fd3b1b7
History | View | Annotate | Download (16.6 KB)
| 1 | 441:cbce1fd3b1b7 | Chris | # Redmine - project management software |
|---|---|---|---|
| 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
||
| 3 | 0:513646585e45 | Chris | # |
| 4 | # This program is free software; you can redistribute it and/or |
||
| 5 | # modify it under the terms of the GNU General Public License |
||
| 6 | # as published by the Free Software Foundation; either version 2 |
||
| 7 | # of the License, or (at your option) any later version. |
||
| 8 | 441:cbce1fd3b1b7 | Chris | # |
| 9 | 0:513646585e45 | Chris | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 12 | # GNU General Public License for more details. |
||
| 13 | 441:cbce1fd3b1b7 | Chris | # |
| 14 | 0:513646585e45 | Chris | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program; if not, write to the Free Software |
||
| 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
| 17 | |||
| 18 | 119:8661b858af72 | Chris | require File.expand_path('../../test_helper', __FILE__)
|
| 19 | 0:513646585e45 | Chris | |
| 20 | class RepositoryGitTest < ActiveSupport::TestCase |
||
| 21 | 245:051f544170fe | Chris | fixtures :projects, :repositories, :enabled_modules, :users, :roles |
| 22 | |||
| 23 | 0:513646585e45 | Chris | # No '..' in the repository path |
| 24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository'
|
||
| 25 | REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
||
| 26 | 245:051f544170fe | Chris | |
| 27 | FELIX_HEX = "Felix Sch\xC3\xA4fer" |
||
| 28 | 441:cbce1fd3b1b7 | Chris | CHAR_1_HEX = "\xc3\x9c" |
| 29 | 245:051f544170fe | Chris | |
| 30 | 441:cbce1fd3b1b7 | Chris | ## Ruby uses ANSI api to fork a process on Windows. |
| 31 | ## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem |
||
| 32 | ## and these are incompatible with ASCII. |
||
| 33 | # WINDOWS_PASS = Redmine::Platform.mswin? |
||
| 34 | WINDOWS_PASS = false |
||
| 35 | 245:051f544170fe | Chris | |
| 36 | 441:cbce1fd3b1b7 | Chris | if File.directory?(REPOSITORY_PATH) |
| 37 | def setup |
||
| 38 | klass = Repository::Git |
||
| 39 | assert_equal "Git", klass.scm_name |
||
| 40 | assert klass.scm_adapter_class |
||
| 41 | assert_not_equal "", klass.scm_command |
||
| 42 | assert_equal true, klass.scm_available |
||
| 43 | |||
| 44 | @project = Project.find(3) |
||
| 45 | @repository = Repository::Git.create( |
||
| 46 | :project => @project, |
||
| 47 | :url => REPOSITORY_PATH, |
||
| 48 | :path_encoding => 'ISO-8859-1' |
||
| 49 | ) |
||
| 50 | assert @repository |
||
| 51 | @char_1 = CHAR_1_HEX.dup |
||
| 52 | if @char_1.respond_to?(:force_encoding) |
||
| 53 | @char_1.force_encoding('UTF-8')
|
||
| 54 | end |
||
| 55 | end |
||
| 56 | |||
| 57 | 0:513646585e45 | Chris | def test_fetch_changesets_from_scratch |
| 58 | 441:cbce1fd3b1b7 | Chris | assert_nil @repository.extra_info |
| 59 | |||
| 60 | 0:513646585e45 | Chris | @repository.fetch_changesets |
| 61 | @repository.reload |
||
| 62 | 245:051f544170fe | Chris | |
| 63 | 441:cbce1fd3b1b7 | Chris | assert_equal 21, @repository.changesets.count |
| 64 | assert_equal 33, @repository.changes.count |
||
| 65 | 245:051f544170fe | Chris | |
| 66 | 0:513646585e45 | Chris | commit = @repository.changesets.find(:first, :order => 'committed_on ASC') |
| 67 | assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments |
||
| 68 | assert_equal "jsmith <jsmith@foo.bar>", commit.committer |
||
| 69 | assert_equal User.find_by_login('jsmith'), commit.user
|
||
| 70 | # TODO: add a commit with commit time <> author time to the test repository |
||
| 71 | assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on |
||
| 72 | assert_equal "2007-12-14".to_date, commit.commit_date |
||
| 73 | assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.revision |
||
| 74 | assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid |
||
| 75 | assert_equal 3, commit.changes.count |
||
| 76 | change = commit.changes.sort_by(&:path).first |
||
| 77 | assert_equal "README", change.path |
||
| 78 | assert_equal "A", change.action |
||
| 79 | 441:cbce1fd3b1b7 | Chris | |
| 80 | assert_equal 4, @repository.extra_info["branches"].size |
||
| 81 | 0:513646585e45 | Chris | end |
| 82 | 441:cbce1fd3b1b7 | Chris | |
| 83 | 0:513646585e45 | Chris | def test_fetch_changesets_incremental |
| 84 | @repository.fetch_changesets |
||
| 85 | 441:cbce1fd3b1b7 | Chris | @repository.reload |
| 86 | assert_equal 21, @repository.changesets.count |
||
| 87 | assert_equal 33, @repository.changes.count |
||
| 88 | extra_info_db = @repository.extra_info["branches"] |
||
| 89 | assert_equal 4, extra_info_db.size |
||
| 90 | assert_equal "1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127", |
||
| 91 | extra_info_db["latin-1-path-encoding"]["last_scmid"] |
||
| 92 | assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
||
| 93 | extra_info_db["master"]["last_scmid"] |
||
| 94 | |||
| 95 | del_revs = [ |
||
| 96 | "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
||
| 97 | "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
||
| 98 | "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
||
| 99 | "deff712f05a90d96edbd70facc47d944be5897e3", |
||
| 100 | "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf", |
||
| 101 | "7e61ac704deecde634b51e59daa8110435dcb3da", |
||
| 102 | ] |
||
| 103 | @repository.changesets.each do |rev| |
||
| 104 | rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
|
||
| 105 | end |
||
| 106 | 0:513646585e45 | Chris | @repository.reload |
| 107 | 245:051f544170fe | Chris | cs1 = @repository.changesets |
| 108 | 441:cbce1fd3b1b7 | Chris | assert_equal 15, cs1.count |
| 109 | h = @repository.extra_info.dup |
||
| 110 | h["branches"]["master"]["last_scmid"] = |
||
| 111 | "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" |
||
| 112 | @repository.merge_extra_info(h) |
||
| 113 | @repository.save |
||
| 114 | @repository.reload |
||
| 115 | extra_info_db_1 = @repository.extra_info["branches"] |
||
| 116 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", |
||
| 117 | extra_info_db_1["master"]["last_scmid"] |
||
| 118 | 245:051f544170fe | Chris | |
| 119 | 0:513646585e45 | Chris | @repository.fetch_changesets |
| 120 | 441:cbce1fd3b1b7 | Chris | assert_equal 21, @repository.changesets.count |
| 121 | end |
||
| 122 | |||
| 123 | def test_fetch_changesets_invalid_rev |
||
| 124 | @repository.fetch_changesets |
||
| 125 | @repository.reload |
||
| 126 | assert_equal 21, @repository.changesets.count |
||
| 127 | assert_equal 33, @repository.changes.count |
||
| 128 | extra_info_db = @repository.extra_info["branches"] |
||
| 129 | assert_equal 4, extra_info_db.size |
||
| 130 | assert_equal "1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127", |
||
| 131 | extra_info_db["latin-1-path-encoding"]["last_scmid"] |
||
| 132 | assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
||
| 133 | extra_info_db["master"]["last_scmid"] |
||
| 134 | |||
| 135 | del_revs = [ |
||
| 136 | "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
||
| 137 | "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
||
| 138 | "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
||
| 139 | "deff712f05a90d96edbd70facc47d944be5897e3", |
||
| 140 | "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf", |
||
| 141 | "7e61ac704deecde634b51e59daa8110435dcb3da", |
||
| 142 | ] |
||
| 143 | @repository.changesets.each do |rev| |
||
| 144 | rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
|
||
| 145 | end |
||
| 146 | @repository.reload |
||
| 147 | cs1 = @repository.changesets |
||
| 148 | assert_equal 15, cs1.count |
||
| 149 | h = @repository.extra_info.dup |
||
| 150 | h["branches"]["master"]["last_scmid"] = |
||
| 151 | "abcd1234efgh" |
||
| 152 | @repository.merge_extra_info(h) |
||
| 153 | @repository.save |
||
| 154 | @repository.reload |
||
| 155 | extra_info_db_1 = @repository.extra_info["branches"] |
||
| 156 | assert_equal "abcd1234efgh", |
||
| 157 | extra_info_db_1["master"]["last_scmid"] |
||
| 158 | |||
| 159 | @repository.fetch_changesets |
||
| 160 | assert_equal 15, @repository.changesets.count |
||
| 161 | end |
||
| 162 | |||
| 163 | def test_db_consistent_ordering_init |
||
| 164 | assert_nil @repository.extra_info |
||
| 165 | @repository.fetch_changesets |
||
| 166 | @repository.reload |
||
| 167 | assert_equal 1, @repository.extra_info["db_consistent"]["ordering"] |
||
| 168 | end |
||
| 169 | |||
| 170 | def test_db_consistent_ordering_before_1_2 |
||
| 171 | assert_nil @repository.extra_info |
||
| 172 | @repository.fetch_changesets |
||
| 173 | @repository.reload |
||
| 174 | assert_equal 21, @repository.changesets.count |
||
| 175 | assert_not_nil @repository.extra_info |
||
| 176 | @repository.write_attribute(:extra_info, nil) |
||
| 177 | @repository.save |
||
| 178 | assert_nil @repository.extra_info |
||
| 179 | assert_equal 21, @repository.changesets.count |
||
| 180 | @repository.fetch_changesets |
||
| 181 | @repository.reload |
||
| 182 | assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
||
| 183 | |||
| 184 | del_revs = [ |
||
| 185 | "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c", |
||
| 186 | "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", |
||
| 187 | "4f26664364207fa8b1af9f8722647ab2d4ac5d43", |
||
| 188 | "deff712f05a90d96edbd70facc47d944be5897e3", |
||
| 189 | "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf", |
||
| 190 | "7e61ac704deecde634b51e59daa8110435dcb3da", |
||
| 191 | ] |
||
| 192 | @repository.changesets.each do |rev| |
||
| 193 | rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
|
||
| 194 | end |
||
| 195 | @repository.reload |
||
| 196 | cs1 = @repository.changesets |
||
| 197 | assert_equal 15, cs1.count |
||
| 198 | assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
||
| 199 | h = @repository.extra_info.dup |
||
| 200 | h["branches"]["master"]["last_scmid"] = |
||
| 201 | "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8" |
||
| 202 | @repository.merge_extra_info(h) |
||
| 203 | @repository.save |
||
| 204 | @repository.reload |
||
| 205 | extra_info_db_1 = @repository.extra_info["branches"] |
||
| 206 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", |
||
| 207 | extra_info_db_1["master"]["last_scmid"] |
||
| 208 | |||
| 209 | @repository.fetch_changesets |
||
| 210 | assert_equal 21, @repository.changesets.count |
||
| 211 | assert_equal 0, @repository.extra_info["db_consistent"]["ordering"] |
||
| 212 | end |
||
| 213 | |||
| 214 | def test_latest_changesets |
||
| 215 | @repository.fetch_changesets |
||
| 216 | @repository.reload |
||
| 217 | # with limit |
||
| 218 | changesets = @repository.latest_changesets('', nil, 2)
|
||
| 219 | assert_equal 2, changesets.size |
||
| 220 | |||
| 221 | # with path |
||
| 222 | changesets = @repository.latest_changesets('images', nil)
|
||
| 223 | assert_equal [ |
||
| 224 | 'deff712f05a90d96edbd70facc47d944be5897e3', |
||
| 225 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 226 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 227 | ], changesets.collect(&:revision) |
||
| 228 | |||
| 229 | changesets = @repository.latest_changesets('README', nil)
|
||
| 230 | assert_equal [ |
||
| 231 | '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', |
||
| 232 | '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', |
||
| 233 | '713f4944648826f558cf548222f813dabe7cbb04', |
||
| 234 | '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', |
||
| 235 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 236 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 237 | ], changesets.collect(&:revision) |
||
| 238 | |||
| 239 | # with path, revision and limit |
||
| 240 | changesets = @repository.latest_changesets('images', '899a15dba')
|
||
| 241 | assert_equal [ |
||
| 242 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 243 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 244 | ], changesets.collect(&:revision) |
||
| 245 | |||
| 246 | changesets = @repository.latest_changesets('images', '899a15dba', 1)
|
||
| 247 | assert_equal [ |
||
| 248 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 249 | ], changesets.collect(&:revision) |
||
| 250 | |||
| 251 | changesets = @repository.latest_changesets('README', '899a15dba')
|
||
| 252 | assert_equal [ |
||
| 253 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 254 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 255 | ], changesets.collect(&:revision) |
||
| 256 | |||
| 257 | changesets = @repository.latest_changesets('README', '899a15dba', 1)
|
||
| 258 | assert_equal [ |
||
| 259 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 260 | ], changesets.collect(&:revision) |
||
| 261 | |||
| 262 | # with path, tag and limit |
||
| 263 | changesets = @repository.latest_changesets('images', 'tag01.annotated')
|
||
| 264 | assert_equal [ |
||
| 265 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 266 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 267 | ], changesets.collect(&:revision) |
||
| 268 | |||
| 269 | changesets = @repository.latest_changesets('images', 'tag01.annotated', 1)
|
||
| 270 | assert_equal [ |
||
| 271 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 272 | ], changesets.collect(&:revision) |
||
| 273 | |||
| 274 | changesets = @repository.latest_changesets('README', 'tag01.annotated')
|
||
| 275 | assert_equal [ |
||
| 276 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 277 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 278 | ], changesets.collect(&:revision) |
||
| 279 | |||
| 280 | changesets = @repository.latest_changesets('README', 'tag01.annotated', 1)
|
||
| 281 | assert_equal [ |
||
| 282 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 283 | ], changesets.collect(&:revision) |
||
| 284 | |||
| 285 | # with path, branch and limit |
||
| 286 | changesets = @repository.latest_changesets('images', 'test_branch')
|
||
| 287 | assert_equal [ |
||
| 288 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 289 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 290 | ], changesets.collect(&:revision) |
||
| 291 | |||
| 292 | changesets = @repository.latest_changesets('images', 'test_branch', 1)
|
||
| 293 | assert_equal [ |
||
| 294 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 295 | ], changesets.collect(&:revision) |
||
| 296 | |||
| 297 | changesets = @repository.latest_changesets('README', 'test_branch')
|
||
| 298 | assert_equal [ |
||
| 299 | '713f4944648826f558cf548222f813dabe7cbb04', |
||
| 300 | '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', |
||
| 301 | '899a15dba03a3b350b89c3f537e4bbe02a03cdc9', |
||
| 302 | '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 303 | ], changesets.collect(&:revision) |
||
| 304 | |||
| 305 | changesets = @repository.latest_changesets('README', 'test_branch', 2)
|
||
| 306 | assert_equal [ |
||
| 307 | '713f4944648826f558cf548222f813dabe7cbb04', |
||
| 308 | '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', |
||
| 309 | ], changesets.collect(&:revision) |
||
| 310 | |||
| 311 | # latin-1 encoding path |
||
| 312 | changesets = @repository.latest_changesets( |
||
| 313 | "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89')
|
||
| 314 | assert_equal [ |
||
| 315 | '64f1f3e89ad1cb57976ff0ad99a107012ba3481d', |
||
| 316 | '4fc55c43bf3d3dc2efb66145365ddc17639ce81e', |
||
| 317 | ], changesets.collect(&:revision) |
||
| 318 | |||
| 319 | changesets = @repository.latest_changesets( |
||
| 320 | "latin-1-dir/test-#{@char_1}-2.txt", '64f1f3e89', 1)
|
||
| 321 | assert_equal [ |
||
| 322 | '64f1f3e89ad1cb57976ff0ad99a107012ba3481d', |
||
| 323 | ], changesets.collect(&:revision) |
||
| 324 | end |
||
| 325 | |||
| 326 | def test_latest_changesets_latin_1_dir |
||
| 327 | if WINDOWS_PASS |
||
| 328 | # |
||
| 329 | else |
||
| 330 | @repository.fetch_changesets |
||
| 331 | @repository.reload |
||
| 332 | changesets = @repository.latest_changesets( |
||
| 333 | "latin-1-dir/test-#{@char_1}-subdir", '1ca7f5ed')
|
||
| 334 | assert_equal [ |
||
| 335 | '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', |
||
| 336 | ], changesets.collect(&:revision) |
||
| 337 | end |
||
| 338 | 0:513646585e45 | Chris | end |
| 339 | 119:8661b858af72 | Chris | |
| 340 | def test_find_changeset_by_name |
||
| 341 | @repository.fetch_changesets |
||
| 342 | @repository.reload |
||
| 343 | ['7234cb2750b63f47bff735edc50a1c0a433c2518', '7234cb2750b'].each do |r| |
||
| 344 | assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', |
||
| 345 | @repository.find_changeset_by_name(r).revision |
||
| 346 | end |
||
| 347 | end |
||
| 348 | |||
| 349 | def test_find_changeset_by_empty_name |
||
| 350 | @repository.fetch_changesets |
||
| 351 | @repository.reload |
||
| 352 | ['', ' ', nil].each do |r| |
||
| 353 | assert_nil @repository.find_changeset_by_name(r) |
||
| 354 | end |
||
| 355 | end |
||
| 356 | |||
| 357 | def test_identifier |
||
| 358 | @repository.fetch_changesets |
||
| 359 | @repository.reload |
||
| 360 | 441:cbce1fd3b1b7 | Chris | c = @repository.changesets.find_by_revision( |
| 361 | '7234cb2750b63f47bff735edc50a1c0a433c2518') |
||
| 362 | 119:8661b858af72 | Chris | assert_equal c.scmid, c.identifier |
| 363 | end |
||
| 364 | |||
| 365 | def test_format_identifier |
||
| 366 | @repository.fetch_changesets |
||
| 367 | @repository.reload |
||
| 368 | 441:cbce1fd3b1b7 | Chris | c = @repository.changesets.find_by_revision( |
| 369 | '7234cb2750b63f47bff735edc50a1c0a433c2518') |
||
| 370 | 119:8661b858af72 | Chris | assert_equal '7234cb27', c.format_identifier |
| 371 | end |
||
| 372 | |||
| 373 | def test_activities |
||
| 374 | c = Changeset.new(:repository => @repository, |
||
| 375 | :committed_on => Time.now, |
||
| 376 | :revision => 'abc7234cb2750b63f47bff735edc50a1c0a433c2', |
||
| 377 | :scmid => 'abc7234cb2750b63f47bff735edc50a1c0a433c2', |
||
| 378 | :comments => 'test') |
||
| 379 | assert c.event_title.include?('abc7234c:')
|
||
| 380 | assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev] |
||
| 381 | end |
||
| 382 | 245:051f544170fe | Chris | |
| 383 | def test_log_utf8 |
||
| 384 | @repository.fetch_changesets |
||
| 385 | @repository.reload |
||
| 386 | 441:cbce1fd3b1b7 | Chris | str_felix_hex = FELIX_HEX.dup |
| 387 | 245:051f544170fe | Chris | if str_felix_hex.respond_to?(:force_encoding) |
| 388 | str_felix_hex.force_encoding('UTF-8')
|
||
| 389 | end |
||
| 390 | 441:cbce1fd3b1b7 | Chris | c = @repository.changesets.find_by_revision( |
| 391 | 'ed5bb786bbda2dee66a2d50faf51429dbc043a7b') |
||
| 392 | 245:051f544170fe | Chris | assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer
|
| 393 | end |
||
| 394 | 441:cbce1fd3b1b7 | Chris | |
| 395 | def test_previous |
||
| 396 | @repository.fetch_changesets |
||
| 397 | @repository.reload |
||
| 398 | %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1| |
||
| 399 | changeset = @repository.find_changeset_by_name(r1) |
||
| 400 | %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2| |
||
| 401 | assert_equal @repository.find_changeset_by_name(r2), changeset.previous |
||
| 402 | end |
||
| 403 | end |
||
| 404 | end |
||
| 405 | |||
| 406 | def test_previous_nil |
||
| 407 | @repository.fetch_changesets |
||
| 408 | @repository.reload |
||
| 409 | %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb2|.each do |r1| |
||
| 410 | changeset = @repository.find_changeset_by_name(r1) |
||
| 411 | assert_nil changeset.previous |
||
| 412 | end |
||
| 413 | end |
||
| 414 | |||
| 415 | def test_next |
||
| 416 | @repository.fetch_changesets |
||
| 417 | @repository.reload |
||
| 418 | %w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2| |
||
| 419 | changeset = @repository.find_changeset_by_name(r2) |
||
| 420 | %w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1| |
||
| 421 | assert_equal @repository.find_changeset_by_name(r1), changeset.next |
||
| 422 | end |
||
| 423 | end |
||
| 424 | end |
||
| 425 | |||
| 426 | def test_next_nil |
||
| 427 | @repository.fetch_changesets |
||
| 428 | @repository.reload |
||
| 429 | %w|67e7792ce20ccae2e4bb73eed09bb397819c8834 67e7792ce20cca|.each do |r1| |
||
| 430 | changeset = @repository.find_changeset_by_name(r1) |
||
| 431 | assert_nil changeset.next |
||
| 432 | end |
||
| 433 | end |
||
| 434 | 0:513646585e45 | Chris | else |
| 435 | puts "Git test repository NOT FOUND. Skipping unit tests !!!" |
||
| 436 | def test_fake; assert true end |
||
| 437 | end |
||
| 438 | end |