From 307252e9aeab91ac60af71a0609270de2434b7b3 Mon Sep 17 00:00:00 2001 From: millefalcon Date: Mon, 8 Jun 2020 07:51:34 -0400 Subject: [PATCH] Added example to show the AsRef working --- exercises/conversions/as_ref_mut.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/exercises/conversions/as_ref_mut.rs b/exercises/conversions/as_ref_mut.rs index aa1e623..963c0f2 100644 --- a/exercises/conversions/as_ref_mut.rs +++ b/exercises/conversions/as_ref_mut.rs @@ -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)); + } }