Sha256: d976c4bacb8b5b48e459533336ee2093cbd8560d547e6759bfd5811a72b406ed

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

require 'dandelion/git'
require 'test/unit'

class TestGit < Test::Unit::TestCase
  def setup
    @repo = Dandelion::Git::Repo.new(File.join(File.dirname(__FILE__), 'test_git.git'))
  end
  
  def test_tree_files
    tree = Dandelion::Git::Tree.new(@repo, 'HEAD')
    files = ['foo', 'bar', 'baz/foo', 'baz/bar']
    assert_equal files.sort, tree.files.sort
  end
  
  def test_tree_show
    tree = Dandelion::Git::Tree.new(@repo, 'HEAD')
    assert_equal "bar\n", tree.show('foo')
    assert_equal "bar\n", tree.show('baz/foo')
  end
  
  def test_tree_revision
    revision = 'ff1f1d4bd0c99e1c9cca047c46b2194accf89504'
    tree = Dandelion::Git::Tree.new(@repo, revision)
    assert_equal revision, tree.revision
  end
  
  def test_diff_changed
    from = 'ff1f1d4bd0c99e1c9cca047c46b2194accf89504'
    to = '88d4480861346093048e08ce8dcc577d8aa69379'
    files = ['foo', 'baz/foo']
    diff = Dandelion::Git::Diff.new(@repo, from, to)
    assert_equal files.sort, diff.changed.sort
    assert_equal [], diff.deleted
  end
  
  def test_diff_deleted
    from = 'f55f3c44c89e5d215fbaaef9d33563117fe0b61b'
    to = '0ca605e9f0f1d42ce8193ac36db11ec3cc9efc08'
    files = ['test_delete']
    diff = Dandelion::Git::Diff.new(@repo, from, to)
    assert_equal files.sort, diff.deleted.sort
    assert_equal [], diff.changed
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dandelion-0.3.11 test/test_git.rb
dandelion-0.3.10 test/test_git.rb
dandelion-0.3.9 test/test_git.rb
dandelion-0.3.8 test/test_git.rb
dandelion-0.3.7 test/test_git.rb
dandelion-0.3.6 test/test_git.rb
dandelion-0.3.5 test/test_git.rb
dandelion-0.3.4 test/test_git.rb
dandelion-0.3.3 test/test_git.rb
dandelion-0.3.2 test/test_git.rb
dandelion-0.3.1 test/test_git.rb
dandelion-0.3.0 test/test_git.rb
dandelion-0.2.3 test/test_git.rb
dandelion-0.2.2 test/test_git.rb
dandelion-0.2.1 test/test_git.rb
dandelion-0.2.0 test/test_git.rb