1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
13 // Tests for the various helper functions used by the needless_continue
14 // lint that don't belong in utils.
16 extern crate clippy_lints;
17 use clippy_lints::needless_continue::{erode_block, erode_from_back, erode_from_front};
21 fn test_erode_from_back() {
25 let y = format!(\"{}\", 42);
31 let y = format!(\"{}\", 42);";
33 let got = erode_from_back(input);
34 assert_eq!(expected, got);
39 fn test_erode_from_back_no_brace() {
45 let got = erode_from_back(input);
46 assert_eq!(expected, got);
51 fn test_erode_from_front() {
63 let got = erode_from_front(input);
64 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
65 assert_eq!(expected, got);
70 fn test_erode_from_front_no_brace() {
79 let got = erode_from_front(input);
80 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
81 assert_eq!(expected, got);
86 fn test_erode_block() {
97 let got = erode_block(input);
98 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
99 assert_eq!(expected, got);