File: test_show.rb

package info (click to toggle)
ruby-git 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,124 kB
  • sloc: ruby: 5,385; sh: 507; perl: 64; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../test_helper'

class TestShow < Test::Unit::TestCase
  def test_do_not_chomp_contents
    in_temp_dir do
      file_name = 'README.md'
      expected_contents = "hello\nworld\n\n"

      g = Git.init
      g.commit('Initial commit', allow_empty: true)
      new_file(file_name, expected_contents)
      g.add(file_name)
      # Show the file from the index by prefixing the file namne with a colon
      contents = g.show(":#{file_name}")
      assert_equal(expected_contents, contents)
    end
  end
end