Fix #422 - False negative: sorted imports with : (#444)

* Fix #422 - False negative: sorted imports with :

* Fix #422: Add another test
This commit is contained in:
Sebastian Wilzbach 2017-06-12 10:29:20 +02:00 committed by Basile Burg
parent 6fad779ec2
commit 6d34b149a9
1 changed files with 16 additions and 1 deletions

View File

@ -72,7 +72,7 @@ class ImportSortednessCheck : BaseAnalyzer
foreach (importBind; id.importBindings.importBinds)
{
addImport(importModuleName ~ "_" ~ importBind.left.text, id.importBindings.singleImport);
addImport(importModuleName ~ "-" ~ importBind.left.text, id.importBindings.singleImport);
}
}
}
@ -341,5 +341,20 @@ unittest
ImportSortednessCheck.MESSAGE,
), sac);
// issue 422 - sorted imports with :
assertAnalyzerWarnings(q{
import foo.bar : bar;
import foo.barbar;
}, sac);
// issue 422 - sorted imports with :
assertAnalyzerWarnings(q{
import foo;
import foo.bar;
import fooa;
import std.range : Take;
import std.range.primitives : isInputRange, walkLength;
}, sac);
stderr.writeln("Unittest for ImportSortednessCheck passed.");
}