Skip to content

test: git show should not chomp results #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2021
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