Skip to content

Commit e2fd4af

Browse files
authored
test: git show should not chomp results (#513)
Refs #503 Signed-off-by: James Couball <jcouball@yahoo.com>
1 parent bd026d3 commit e2fd4af

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/units/test_show.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env ruby
2+
3+
require File.dirname(__FILE__) + '/../test_helper'
4+
5+
class TestShow < Test::Unit::TestCase
6+
def test_do_not_chomp_contents
7+
in_temp_dir do
8+
file_name = 'README.md'
9+
expected_contents = "hello\nworld\n\n"
10+
11+
g = Git.init
12+
g.commit('Initial commit', allow_empty: true)
13+
new_file(file_name, expected_contents)
14+
g.add(file_name)
15+
# Show the file from the index by prefixing the file namne with a colon
16+
contents = g.show(":#{file_name}")
17+
assert_equal(expected_contents, contents)
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)