Skip to content

Commit

Permalink
Added example to show the AsRef working
Browse files Browse the repository at this point in the history
  • Loading branch information
millefalcon committed Jun 8, 2020
1 parent bb2ca25 commit 307252e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions exercises/conversions/as_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ mod tests {
let s = "Cafe au lait";
assert_eq!(char_counter(s), byte_counter(s));
}

#[test]
fn different_counts_using_string() {
let s = String::from("Café au lait");
assert_ne!(char_counter(s.clone()), byte_counter(s));
}

#[test]
fn same_counts_using_string() {
let s = String::from("Cafe au lait");
assert_eq!(char_counter(s.clone()), byte_counter(s));
}
}

0 comments on commit 307252e

Please sign in to comment.