1 require File.dirname(__FILE__) + '/../test_helper'
4 class BzrCommitsTest < Scm::Test
7 with_bzr_repository('bzr') do |bzr|
8 assert_equal 6, bzr.commit_count
9 assert_equal 6, bzr.commit_count(0)
10 assert_equal 5, bzr.commit_count(1)
11 assert_equal 1, bzr.commit_count(5)
12 assert_equal 0, bzr.commit_count(6)
16 def test_commit_tokens
17 with_bzr_repository('bzr') do |bzr|
18 assert_equal ['1', '2', '3', '4', '5', '6'], bzr.commit_tokens
19 assert_equal ['2', '3', '4', '5', '6'], bzr.commit_tokens(1)
20 assert_equal ['6'], bzr.commit_tokens(5)
21 assert_equal [], bzr.commit_tokens(6)
26 with_bzr_repository('bzr') do |bzr|
27 assert_equal ['1', '2', '3', '4', '5', '6'], bzr.commits.collect { |c| c.token }
28 assert_equal ['6'], bzr.commits(5).collect { |c| c.token }
29 assert_equal [], bzr.commits(6).collect { |c| c.token }
31 # Check that the diffs are not populated
32 assert_equal [], bzr.commits.first.diffs
37 with_bzr_repository('bzr') do |bzr|
39 bzr.each_commit do |c|
40 assert c.committer_name
41 assert c.committer_date.is_a?(Time)
42 assert c.message.length > 0
44 # Check that the diffs are populated
46 assert d.action =~ /^[MAD]$/
47 assert d.path.length > 0
52 # Make sure we cleaned up after ourselves
53 assert !FileTest.exist?(bzr.log_filename)
55 # Verify that we got the commits in forward chronological order
56 assert_equal ['1', '2', '3', '4', '5', '6'], commits.collect{ |c| c.token }