Skip to content

Commit f13dfdd

Browse files
author
scott Chacon
committed
updated the unit test to look at some of the archive files
1 parent 58dfeb3 commit f13dfdd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/units/test_archive.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ def test_archive
2222

2323
f = @git.object('v2.6').archive # returns path to temp file
2424
assert(File.exists?(f))
25-
25+
26+
f = @git.object('v2.6').archive(nil, :format => 'tar') # returns path to temp file
27+
assert(File.exists?(f))
28+
29+
lines = `cd /tmp; tar xvpf #{f}`.split("\n")
30+
assert_equal('ex_dir/', lines[0])
31+
assert_equal('example.txt', lines[2])
32+
2633
f = @git.object('v2.6').archive(tempfile, :format => 'zip')
2734
assert(File.file?(f))
2835

@@ -31,6 +38,10 @@ def test_archive
3138

3239
f = @git.object('v2.6').archive(tempfile, :format => 'tar', :prefix => 'test/', :path => 'ex_dir/')
3340
assert(File.exists?(f))
41+
42+
lines = `cd /tmp; tar xvpf #{f}`.split("\n")
43+
assert_equal('test/', lines[0])
44+
assert_equal('test/ex_dir/ex.txt', lines[2])
3445

3546
in_temp_dir do
3647
c = Git.clone(@wbare, 'new')

0 commit comments

Comments
 (0)