Index: pkg/analyzer/test/src/dart/analysis/base.dart |
diff --git a/pkg/analyzer/test/src/dart/analysis/base.dart b/pkg/analyzer/test/src/dart/analysis/base.dart |
index a09836dd37554cdc528766dbd8f63785b5602108..ca912ec4144d92b1c46f3e5d57aeb0483d4030c4 100644 |
--- a/pkg/analyzer/test/src/dart/analysis/base.dart |
+++ b/pkg/analyzer/test/src/dart/analysis/base.dart |
@@ -13,6 +13,7 @@ import 'package:analyzer/src/dart/analysis/file_state.dart'; |
import 'package:analyzer/src/dart/analysis/status.dart'; |
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl; |
import 'package:analyzer/src/generated/source.dart'; |
+import 'package:test/test.dart'; |
import '../../context/mock_sdk.dart'; |
@@ -45,6 +46,33 @@ class BaseAnalysisDriverTest { |
} |
} |
+ int findOffset(String search) { |
+ int offset = testCode.indexOf(search); |
+ expect(offset, isNonNegative, reason: "Not found '$search' in\n$testCode"); |
Brian Wilkerson
2016/11/21 21:17:11
nit: "Not found" --> "Did not find"
|
+ return offset; |
+ } |
+ |
+ int getLeadingIdentifierLength(String search) { |
+ int length = 0; |
+ while (length < search.length) { |
+ int c = search.codeUnitAt(length); |
+ if (c >= 'a'.codeUnitAt(0) && c <= 'z'.codeUnitAt(0)) { |
+ length++; |
+ continue; |
+ } |
+ if (c >= 'A'.codeUnitAt(0) && c <= 'Z'.codeUnitAt(0)) { |
+ length++; |
+ continue; |
+ } |
+ if (c >= '0'.codeUnitAt(0) && c <= '9'.codeUnitAt(0)) { |
+ length++; |
+ continue; |
+ } |
+ break; |
+ } |
+ return length; |
+ } |
+ |
void setUp() { |
new MockSdk(); |
testProject = _p('/test/lib'); |