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.
10 // Tests for the various helper functions used by the needless_continue
11 // lint that don't belong in utils.
13 extern crate clippy_lints;
14 use clippy_lints::needless_continue::{erode_block, erode_from_back, erode_from_front};
18 fn test_erode_from_back() {
22 let y = format!(\"{}\", 42);
28 let y = format!(\"{}\", 42);";
30 let got = erode_from_back(input);
31 assert_eq!(expected, got);
36 fn test_erode_from_back_no_brace() {
42 let got = erode_from_back(input);
43 assert_eq!(expected, got);
48 fn test_erode_from_front() {
60 let got = erode_from_front(input);
61 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
62 assert_eq!(expected, got);
67 fn test_erode_from_front_no_brace() {
76 let got = erode_from_front(input);
77 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
78 assert_eq!(expected, got);
83 fn test_erode_block() {
94 let got = erode_block(input);
95 println!("input: {}\nexpected:\n{}\ngot:\n{}", input, expected, got);
96 assert_eq!(expected, got);