From d4a569848e68ddcab4d2f59c1e052e7ac0e8e14c Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sat, 9 Dec 2017 16:43:06 +0900 Subject: [PATCH] Add tests for nested imports --- tests/source/imports.rs | 11 +++++++++++ tests/target/imports.rs | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/source/imports.rs b/tests/source/imports.rs index debd851d7b7..73d1419f47d 100644 --- a/tests/source/imports.rs +++ b/tests/source/imports.rs @@ -76,3 +76,14 @@ fn test() { // We shouldn't remove imports which have attributes attached (#1858) #[cfg(unix)] use self::unix::{}; + +// nested imports +use foo::{a, bar::{baz, qux, xxxxxxxxxxx, yyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz}}, b, boo, c,}; + +use fooo::{baar::{foobar::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz}}, z, bar, bar::*, x, y}; + +// nested imports with a single sub-tree. +use a::{b::{c::*}}; +use a::{b::{c::{}}}; +use a::{b::{c::d}}; +use a::{b::{c::{xxx, yyy, zzz}}}; diff --git a/tests/target/imports.rs b/tests/target/imports.rs index 5a2494c50cf..2b825526199 100644 --- a/tests/target/imports.rs +++ b/tests/target/imports.rs @@ -71,3 +71,18 @@ fn test() { // We shouldn't remove imports which have attributes attached (#1858) #[cfg(unix)] use self::unix::{}; + +// nested imports +use foo::{a, b, boo, c, + bar::{baz, qux, xxxxxxxxxxx, yyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, + foo::{a, b, cxxxxxxxxxxxxx, yyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz}}}; + +use fooo::{bar, x, y, z, + baar::foobar::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz}, + bar::*}; + +// nested imports with a single sub-tree. +use a::b::c::*; +use a::b::c::d; +use a::b::c::{xxx, yyy, zzz};