1
0
Fork 0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-05-06 11:16:08 +02:00

Merge pull request #428 from millefalcon/master

Added example with `String` to show the AsRef working
This commit is contained in:
fmoko 2020-06-13 22:15:57 +02:00 committed by GitHub
commit c6295ade33
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));
}
}