Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/units/test_show.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,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