##// END OF EJS Templates
rust-changelog: added a test for `NULL_REVISION` special case...
Georges Racinet -
r51267:b5dd6d6d default
parent child Browse files
Show More
@@ -215,6 +215,8 b' fn debug_bytes(bytes: &[u8]) -> String {'
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]
@@ -268,4 +270,20 b' message",'
268 );
270 );
269 assert_eq!(data.description(), b"some\ncommit\nmessage");
271 assert_eq!(data.description(), b"some\ncommit\nmessage");
270 }
272 }
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(())
271 }
288 }
289 }
General Comments 0
You need to be logged in to leave comments. Login now