mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-26 07:14:17 -05:00
Added example to show the AsRef working
This commit is contained in:
parent
bb2ca25110
commit
307252e9ae
1 changed files with 12 additions and 0 deletions
|
@ -36,4 +36,16 @@ mod tests {
|
||||||
let s = "Cafe au lait";
|
let s = "Cafe au lait";
|
||||||
assert_eq!(char_counter(s), byte_counter(s));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue