Sha256: dd92d7ae23666d2e52b07c4f87c7765f0827bbd2b4eb4fea7c0463da1d0d9c59

Contents?: true

Size: 1.8 KB

Versions: 15

Compression:

Stored size: 1.8 KB

Contents

require_relative '../test_helper'

module OhlohScm::Adapters
  class GitSvnCatFileTest < OhlohScm::Test
    def test_cat_file
      with_git_svn_repository('git_svn') do |git_svn|
        expected = <<-EXPECTED.gsub(/^\s+/, '')
          /* Hello, World! */
          #include <stdio.h>
          main()
          {
            printf("Hello, World!\\n");
          }
        EXPECTED

        assert_equal expected.strip, git_svn.cat_file(OhlohScm::Commit.new(token: 1),
                                                      OhlohScm::Diff.new(path: 'helloworld.c')).gsub(/\t/, '').strip
      end
    end

    def test_cat_file_with_non_existent_token
      with_git_svn_repository('git_svn') do |git_svn|
        assert git_svn.cat_file(OhlohScm::Commit.new(token: 999), OhlohScm::Diff.new(path: 'helloworld.c'))
      end
    end

    def test_cat_file_with_invalid_filename
      with_git_svn_repository('git_svn') do |git_svn|
        assert_raise RuntimeError do
          git_svn.cat_file(OhlohScm::Commit.new(token: 1), OhlohScm::Diff.new(path: 'invalid'))
        end
      end
    end

    def test_cat_file_parent
      with_git_svn_repository('git_svn') do |git_svn|
        expected = <<-EXPECTED.gsub(/^\s+/, '')
          /* Hello, World! */
          #include <stdio.h>
          main()
          {
            printf("Hello, World!\\n");
          }
        EXPECTED

        assert_equal expected.strip, git_svn.cat_file_parent(OhlohScm::Commit.new(token: 2),
                                                       OhlohScm::Diff.new(path: 'helloworld.c')).gsub(/\t/, '')
      end
    end

    def test_cat_file_parent_with_first_token
      with_git_svn_repository('git_svn') do |git_svn|
        assert git_svn.cat_file(OhlohScm::Commit.new(token: 1), OhlohScm::Diff.new(path: 'helloworld.c'))
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ohloh_scm-2.5.1 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.14 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.13 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.12 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.11 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.10 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.9 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.8 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.7 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.6 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.5 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.4 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.3 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.1 test/unit/git_svn_cat_file_test.rb
ohloh_scm-2.4.0 test/unit/git_svn_cat_file_test.rb