History

A manual message parse impl and more tests (#198)

Sebastian Thiel committed 5 years ago

Commit f4b8a0d1 parent 625be8d2 files · +31 −20Browse files

Showing the changes to git-object/tests/immutable/commit (1 of 2 files). Show all

Unified · Split

git-object/tests/immutable/commit/message.rs+14−1
@@ -24,5 +24,18 @@ fn only_title_trailing_newline_is_retained() { · 23 unmodified lines
24 body: None24 body: None
25 }25 }
26 );26 );
27 assert_eq!(msg.summary().as_ref(), "hello there\n");27 assert_eq!(msg.summary().as_ref(), "hello there");
28}
29
30#[test]
31fn title_with_whitespace_and_body() {
32 let msg = MessageRef::from_bytes(b"hello \t \r\n there\nanother line\n\nthe body\n\n");
33 assert_eq!(msg.summary().as_ref(), "hello there another line");
34 assert_eq!(
35 msg,
36 MessageRef {
37 title: b"hello \t \r\n there\nanother line".as_bstr(),
38 body: Some(b"the body\n\n".as_bstr())
39 }
40 );
28}41}