equal
deleted
inserted
replaced
213 } |
213 } |
214 |
214 |
215 #[cfg(test)] |
215 #[cfg(test)] |
216 mod tests { |
216 mod tests { |
217 use super::*; |
217 use super::*; |
|
218 use crate::vfs::Vfs; |
|
219 use crate::NULL_REVISION; |
218 use pretty_assertions::assert_eq; |
220 use pretty_assertions::assert_eq; |
219 |
221 |
220 #[test] |
222 #[test] |
221 fn test_create_changelogrevisiondata_invalid() { |
223 fn test_create_changelogrevisiondata_invalid() { |
222 // Completely empty |
224 // Completely empty |
266 data.files().collect_vec(), |
268 data.files().collect_vec(), |
267 vec![HgPath::new("file1"), HgPath::new("file2")] |
269 vec![HgPath::new("file1"), HgPath::new("file2")] |
268 ); |
270 ); |
269 assert_eq!(data.description(), b"some\ncommit\nmessage"); |
271 assert_eq!(data.description(), b"some\ncommit\nmessage"); |
270 } |
272 } |
271 } |
273 |
|
274 #[test] |
|
275 fn test_data_from_rev_null() -> Result<(), RevlogError> { |
|
276 // an empty revlog will be enough for this case |
|
277 let temp = tempfile::tempdir().unwrap(); |
|
278 let vfs = Vfs { base: temp.path() }; |
|
279 std::fs::write(temp.path().join("foo.i"), b"").unwrap(); |
|
280 let revlog = Revlog::open(&vfs, "foo.i", None, false).unwrap(); |
|
281 |
|
282 let changelog = Changelog { revlog }; |
|
283 assert_eq!( |
|
284 changelog.data_for_rev(NULL_REVISION)?, |
|
285 ChangelogRevisionData::null() |
|
286 ); |
|
287 Ok(()) |
|
288 } |
|
289 } |