From 639c2d6d8ffe615b03bc07a902dcc327df27173a Mon Sep 17 00:00:00 2001 From: Marc Schoolderman Date: Thu, 20 Jun 2024 16:13:44 +0200 Subject: [PATCH] exercise CreateResult code more --- src/system/timestamp.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/system/timestamp.rs b/src/system/timestamp.rs index 603c5c86..2e6666ba 100644 --- a/src/system/timestamp.rs +++ b/src/system/timestamp.rs @@ -315,6 +315,7 @@ pub enum TouchResult { NotFound, } +#[cfg_attr(not(test), allow(dead_code))] pub enum CreateResult { /// The record was found and it was refreshed Updated { @@ -736,9 +737,10 @@ mod tests { std::thread::sleep(std::time::Duration::from_millis(1)); let res = srf.create(tty_scope, auth_user).unwrap(); - let CreateResult::Updated { .. } = res else { + let CreateResult::Updated { old_time, new_time } = res else { panic!("Expected record to be updated"); }; + assert_ne!(old_time, new_time); // reset the file assert!(srf.reset().is_ok());