Skip to content

Commit c44ce2b

Browse files
committed
Copy doctests for contains_only
1 parent b249170 commit c44ce2b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/std/src/coins.rs

+11
Original file line numberDiff line numberDiff line change
@@ -526,4 +526,15 @@ mod tests {
526526
// can still use the coins afterwards
527527
assert_eq!(coins.amount_of("uatom"), Uint256::new(12345));
528528
}
529+
530+
#[test]
531+
fn contains_only_works() {
532+
// doctests copied here because coverage does not work for doctests
533+
let coins: Coins = [coin(100, "uatom")].try_into().unwrap();
534+
assert_eq!(coins.contains_only("uatom").unwrap(), Uint256::new(100));
535+
assert_eq!(coins.contains_only("uluna"), None);
536+
537+
let coins: Coins = [coin(100, "uatom"), coin(200, "uusd")].try_into().unwrap();
538+
assert_eq!(coins.contains_only("uatom"), None);
539+
}
529540
}

0 commit comments

Comments
 (0)