[analysis_server] Extract expected offsets in Extract Local test
Follow-up from https://dart-review.googlesource.com/c/sdk/+/441840. Change-Id: I085099fde59fce052b01fd06a8cc41a83f55ac24 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441941 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Auto-Submit: Danny Tuppeny <danny@tuppeny.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
dff5fe7f85
commit
fb22849379
@@ -11,6 +11,7 @@ import 'package:linter/src/lint_names.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../../utils/test_code_extensions.dart';
|
||||
import 'abstract_refactoring.dart';
|
||||
|
||||
void main() {
|
||||
@@ -1181,7 +1182,7 @@ void f() {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1277,7 +1278,7 @@ void f(int x) {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1306,7 +1307,7 @@ void f(int x) {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1491,7 +1492,7 @@ void f() {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['y'],
|
||||
);
|
||||
}
|
||||
@@ -1512,7 +1513,7 @@ class Point {int x = 0; int y = 0;}
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['x', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1537,7 +1538,7 @@ class Point {int x = 0; int y = 0;}
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['x', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1612,7 +1613,7 @@ void f(int x) {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1639,7 +1640,7 @@ void f(int x) {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 'i'],
|
||||
);
|
||||
}
|
||||
@@ -1811,7 +1812,7 @@ void f() {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['cde'],
|
||||
);
|
||||
}
|
||||
@@ -1832,7 +1833,7 @@ void f() {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['object', 's'],
|
||||
);
|
||||
}
|
||||
@@ -1857,7 +1858,7 @@ void f() {
|
||||
''');
|
||||
_assertSingleLinkedEditGroup(
|
||||
length: 3,
|
||||
offsets: parsedExpectedCode.positions.map((p) => p.offset).toList(),
|
||||
offsets: parsedExpectedCode.positionOffsets,
|
||||
names: ['xy'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ extension ListTestCodeRangeExtension on List<TestCodeRange> {
|
||||
}
|
||||
|
||||
extension TestCodeExtension on TestCode {
|
||||
/// Return the offsets of all [positions].
|
||||
List<int> get positionOffsets => positions.map((p) => p.offset).toList();
|
||||
|
||||
/// Verifies that [actualRanges] match with the marked ranges in [code].
|
||||
///
|
||||
/// This is done by taking the resulting code (without markers) and then
|
||||
|
||||
Reference in New Issue
Block a user