rust/hg-core/src/revlog/changelog.rs
changeset 50410 b5dd6d6d6fa6
parent 50409 b47a9316050a
child 50411 841b13e6e84c
equal deleted inserted replaced
50409:b47a9316050a 50410:b5dd6d6d6fa6
   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 }