Skip to content

Commit b6137f7

Browse files
keertipCommit Queue
authored andcommitted
Issue 54893: Add a test for sorting imports that span 2 lines.
Change-Id: I9ed0a1b754d3f201d760813dafa4c1049b7124f1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360280 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Keerti Parthasarathy <[email protected]>
1 parent 3b23ffe commit b6137f7

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,52 @@ void f(Stream<String> args) {
9393
A.m();
9494
B.m();
9595
}
96+
''');
97+
}
98+
99+
Future<void> test_organizePathImports_thatSpanTwoLines() async {
100+
newFile('$testPackageLibPath/a.dart', '''
101+
class A {
102+
static void m() {}
103+
}
104+
''');
105+
newFile('$testPackageLibPath/a/b.dart', '''
106+
class B {
107+
static void m() {}
108+
}
109+
''');
110+
newFile('$testPackageLibPath/a/c.dart', '''
111+
class C {
112+
static void m() {}
113+
}
114+
''');
115+
116+
await resolveTestCode('''
117+
import 'dart:async';
118+
import 'a/b.dart';
119+
import 'a.dart'
120+
show A;
121+
import 'a/c.dart';
122+
123+
void f(Stream<String> args) {
124+
A.m();
125+
B.m();
126+
C.m();
127+
}
128+
''');
129+
await assertHasFix('''
130+
import 'dart:async';
131+
132+
import 'a.dart'
133+
show A;
134+
import 'a/b.dart';
135+
import 'a/c.dart';
136+
137+
void f(Stream<String> args) {
138+
A.m();
139+
B.m();
140+
C.m();
141+
}
96142
''');
97143
}
98144
}

0 commit comments

Comments
 (0)