…but really, it's not super nice especially considering the counting of consumed bytes is based on ptr arithmetic.
Showing the changes to git-object/tests/immutable/commit (1 of 3 files). Show all
Unified · Split
| @@ -66,6 +66,19 @@ fn title_with_whitespace_and_body() { · 65 unmodified lines | ||
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | +#[test] | |
| 70 | +fn title_with_more_whitespace_and_body() { | |
| 71 | + let msg = MessageRef::from_bytes(b"hello \r\r\r\n there\nanother line\n\nthe body\n\n"); | |
| 72 | + assert_eq!(msg.summary().as_ref(), "hello there another line"); | |
| 73 | + assert_eq!( | |
| 74 | + msg, | |
| 75 | + MessageRef { | |
| 76 | + title: b"hello \r\r\r\n there\nanother line".as_bstr(), | |
| 77 | + body: Some(b"the body\n\n".as_bstr()) | |
| 78 | + } | |
| 79 | + ); | |
| 80 | +} | |
| 81 | + | |
| 69 | 82 | #[test] |
| 70 | 83 | fn title_with_whitespace_and_body_windows_lineending() { |
| 71 | 84 | let msg = MessageRef::from_bytes(b"hello \r\n \r\n there\nanother line\r\n\r\nthe body\n\r\n"); |