Skip to content

Commit b6aa252

Browse files
committed
Added working test for Rugged::Diff.from_buffer(s).
1 parent f0aeafc commit b6aa252

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/diff_test.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ def test_from_strings_with_custom_paths
6666

6767
class RepoDiffTest < Rugged::TestCase
6868
def test_new_from_buffer
69-
repo = FixtureRepo.from_libgit2("attr")
70-
diff = repo.diff("605812a", nil)
71-
patch = diff.patch
72-
diff2 = Rugged::Diff.from_buffer(patch)
73-
puts diff2.inspect
74-
puts diff2.patch.inspect
75-
puts "----------------"
76-
puts patch
77-
#assert_equal diff2.patch, patch
69+
patch1 = Rugged::Patch.from_strings("deleted\n", "added\n", old_path: "old", new_path: "new").to_s
70+
diff1 = Rugged::Diff.from_buffer(patch1)
71+
assert_equal diff1.patch, patch1
72+
73+
# This currently breaks
74+
repo = FixtureRepo.from_libgit2("attr")
75+
diff2 = repo.diff("605812a", nil)
76+
patch2 = diff2.patch
77+
diff3 = Rugged::Diff.from_buffer(patch2)
78+
assert_equal diff3.patch, patch2
7879
end
7980

8081
def test_with_oid_string

0 commit comments

Comments
 (0)