1 // Tests for the various helper functions used by the needless_continue
2 // lint that don't belong in utils.
3 extern crate clippy_lints;
4 use clippy_lints::needless_continue::{erode_from_back, erode_block, erode_from_front};
7 #[cfg_attr(rustfmt, rustfmt_skip)]
8 fn test_erode_from_back() {
12 let y = format!(\"{}\", 42);
18 let y = format!(\"{}\", 42);";
20 let got = erode_from_back(input);
21 assert_eq!(expected, got);
25 #[cfg_attr(rustfmt, rustfmt_skip)]
26 fn test_erode_from_back_no_brace() {
32 let got = erode_from_back(input);
33 assert_eq!(expected, got);
37 #[cfg_attr(rustfmt, rustfmt_skip)]
38 fn test_erode_from_front() {
50 let got = erode_from_front(input);
51 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
52 assert_eq!(expected, got);
56 #[cfg_attr(rustfmt, rustfmt_skip)]
57 fn test_erode_from_front_no_brace() {
66 let got = erode_from_front(input);
67 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
68 assert_eq!(expected, got);
73 #[cfg_attr(rustfmt, rustfmt_skip)]
74 fn test_erode_block() {
85 let got = erode_block(input);
86 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
87 assert_eq!(expected, got);