diff options
Diffstat (limited to 'tests/suggestion.rs')
-rw-r--r-- | tests/suggestion.rs | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/suggestion.rs b/tests/suggestion.rs index 0e1b9fe..5886f16 100644 --- a/tests/suggestion.rs +++ b/tests/suggestion.rs @@ -51,39 +51,35 @@ fn test_apply__replacement_everything() { #[test] fn test_expand__unchanged() { - let s = Suggestion::new(1..1, "oo".into()); - assert_eq!(s.expand("f".into(), 1..1), s); + let mut s = Suggestion::new(1..1, "oo".into()); + s.expand("f", 1..1); + assert_eq!(s, Suggestion::new(1..1, "oo".into())); } #[test] fn test_expand__left() { - let s = Suggestion::new(1..1, "oo".into()); - assert_eq!(s.expand("f".into(), 0..1), Suggestion::new(0..1, "foo".into())); + let mut s = Suggestion::new(1..1, "oo".into()); + s.expand("f", 0..1); + assert_eq!(s, Suggestion::new(0..1, "foo".into())); } #[test] fn test_expand__right() { - let s = Suggestion::new(0..0, "minecraft:".into()); - assert_eq!( - s.expand("fish".into(), 0..4), - Suggestion::new(0..4, "minecraft:fish".into()), - ); + let mut s = Suggestion::new(0..0, "minecraft:".into()); + s.expand("fish", 0..4); + assert_eq!(s, Suggestion::new(0..4, "minecraft:fish".into())); } #[test] fn test_expand__both() { - let s = Suggestion::new(11..11, "minecraft:".into()); - assert_eq!( - s.expand("give Steve fish_block".into(), 5..21), - Suggestion::new(5..21, "Steve minecraft:fish_block".into()), - ); + let mut s = Suggestion::new(11..11, "minecraft:".into()); + s.expand("give Steve fish_block", 5..21); + assert_eq!(s, Suggestion::new(5..21, "Steve minecraft:fish_block".into())); } #[test] fn test_expand__replacement() { - let s = Suggestion::new(6..11, "strangers".into()); - assert_eq!( - s.expand("Hello world!".into(), 0..12), - Suggestion::new(0..12, "Hello strangers!".into()), - ); + let mut s = Suggestion::new(6..11, "strangers".into()); + s.expand("Hello world!", 0..12); + assert_eq!(s, Suggestion::new(0..12, "Hello strangers!".into())); } |