Skip to content

Commit edb9194

Browse files
committed
Add test for dereference of an empty Buf
1 parent d38a2da commit edb9194

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/buf.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,12 @@ impl Drop for Buf {
7575
unsafe { raw::git_buf_dispose(&mut self.raw) }
7676
}
7777
}
78+
79+
#[test]
80+
fn empty_buf() {
81+
let mut buf = Buf::new();
82+
let x: &[u8] = &*buf;
83+
assert_eq!(x.len(), 0);
84+
let x: &mut [u8] = &mut *buf;
85+
assert_eq!(x.len(), 0);
86+
}

0 commit comments

Comments
 (0)