Update tests

This commit is contained in:
Jonas Schievink 2020-09-16 17:24:34 +02:00
parent 4785162b08
commit 603613a302

View File

@ -622,13 +622,65 @@ fn test_check_unnecessary_braces_in_use_statement() {
r#"
use a;
use a::{c, d::e};
mod a {
mod c {}
mod d {
mod e {}
}
}
"#,
);
check_fix(r#"use {<|>b};"#, r#"use b;"#);
check_fix(r#"use {b<|>};"#, r#"use b;"#);
check_fix(r#"use a::{c<|>};"#, r#"use a::c;"#);
check_fix(r#"use a::{self<|>};"#, r#"use a;"#);
check_fix(r#"use a::{c, d::{e<|>}};"#, r#"use a::{c, d::e};"#);
check_fix(
r"
mod b {}
use {<|>b};
",
r"
mod b {}
use b;
",
);
check_fix(
r"
mod b {}
use {b<|>};
",
r"
mod b {}
use b;
",
);
check_fix(
r"
mod a { mod c {} }
use a::{c<|>};
",
r"
mod a { mod c {} }
use a::c;
",
);
check_fix(
r"
mod a {}
use a::{self<|>};
",
r"
mod a {}
use a;
",
);
check_fix(
r"
mod a { mod c {} mod d { mod e {} } }
use a::{c, d::{e<|>}};
",
r"
mod a { mod c {} mod d { mod e {} } }
use a::{c, d::e};
",
);
}
#[test]