Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Dec 22, 2023
1 parent bb37970 commit a4379bb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,30 @@ fn try_update_with_not_contains() {
#[test]
fn try_update_with_failure_does_not_delete_element() {
let mut sut = Users::new();
sut.append(User::new(1, "Blob."));
sut.append(User::new(2, "Blob, Jr."));
assert_eq!(sut.items(), [User::new(2, "Blob, Jr.")]);
sut.append(User::new(3, "Blob, Sr."));

assert_eq!(
sut.items(),
[
User::new(1, "Blob."),
User::new(2, "Blob, Jr."),
User::new(3, "Blob, Sr.")
]
);

assert_eq!(sut.try_update_with(&2, |_| { Err(false) }), Err(false));

// remains unchanged
assert_eq!(sut.items(), [User::new(2, "Blob, Jr.")]);
assert_eq!(
sut.items(),
[
User::new(1, "Blob."),
User::new(2, "Blob, Jr."),
User::new(3, "Blob, Sr.")
]
);
}

#[test]
Expand Down

0 comments on commit a4379bb

Please sign in to comment.