1 // Tests for the various helper functions used by the needless_continue
2 // lint that don't belong in utils.
4 extern crate clippy_lints;
5 use clippy_lints::needless_continue::{erode_block, erode_from_back, erode_from_front};
8 #[cfg_attr(rustfmt, rustfmt_skip)]
9 fn test_erode_from_back() {
13 let y = format!(\"{}\", 42);
19 let y = format!(\"{}\", 42);";
21 let got = erode_from_back(input);
22 assert_eq!(expected, got);
26 #[cfg_attr(rustfmt, rustfmt_skip)]
27 fn test_erode_from_back_no_brace() {
33 let got = erode_from_back(input);
34 assert_eq!(expected, got);
38 #[cfg_attr(rustfmt, rustfmt_skip)]
39 fn test_erode_from_front() {
51 let got = erode_from_front(input);
52 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
53 assert_eq!(expected, got);
57 #[cfg_attr(rustfmt, rustfmt_skip)]
58 fn test_erode_from_front_no_brace() {
67 let got = erode_from_front(input);
68 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
69 assert_eq!(expected, got);
74 #[cfg_attr(rustfmt, rustfmt_skip)]
75 fn test_erode_block() {
86 let got = erode_block(input);
87 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
88 assert_eq!(expected, got);