Skip to content

Commit

Permalink
exercise CreateResult code more
Browse files Browse the repository at this point in the history
  • Loading branch information
squell committed Jun 20, 2024
1 parent 6b18e60 commit 639c2d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/system/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 639c2d6

Please sign in to comment.