Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Unified Diff: pkg/analyzer/test/generated/test_support.dart

Issue 186153005: New analzyer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use meaningful name instead of '_' in predicate. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/code_transformers/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/test_support.dart
diff --git a/pkg/analyzer/test/generated/test_support.dart b/pkg/analyzer/test/generated/test_support.dart
index 20670ac61119dd3d2b2f9853e1b64d608b68ea33..2263acdec569547afcf1ca987eb88867e2bf7726 100644
--- a/pkg/analyzer/test/generated/test_support.dart
+++ b/pkg/analyzer/test/generated/test_support.dart
@@ -9,6 +9,7 @@ library engine.test_support;
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/java_junit.dart';
+import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/scanner.dart';
@@ -617,8 +618,8 @@ class EngineTestCase extends JUnitTestCase {
* @return the object that was being tested
* @throws Exception if the object is not an instance of the expected class
*/
- static Object assertInstanceOf(Type expectedClass, Object object) {
- if (!isInstanceOf(object, expectedClass)) {
+ static Object assertInstanceOf(Predicate<Object> predicate, Type expectedClass, Object object) {
+ if (!predicate(object)) {
JUnitTestCase.fail("Expected instance of ${expectedClass.toString()}, found ${(object == null ? "null" : object.runtimeType.toString())}");
}
return object;
@@ -651,10 +652,10 @@ class EngineTestCase extends JUnitTestCase {
static void assertMatches(Token expectedToken, Token actualToken) {
JUnitTestCase.assertEquals(expectedToken.type, actualToken.type);
if (expectedToken is KeywordToken) {
- assertInstanceOf(KeywordToken, actualToken);
+ assertInstanceOf((obj) => obj is KeywordToken, KeywordToken, actualToken);
JUnitTestCase.assertEquals(expectedToken.keyword, (actualToken as KeywordToken).keyword);
} else if (expectedToken is StringToken) {
- assertInstanceOf(StringToken, actualToken);
+ assertInstanceOf((obj) => obj is StringToken, StringToken, actualToken);
JUnitTestCase.assertEquals(expectedToken.lexeme, (actualToken as StringToken).lexeme);
}
}
@@ -724,13 +725,13 @@ class EngineTestCase extends JUnitTestCase {
/**
* @return the [AstNode] with requested type at offset of the "prefix".
*/
- static AstNode findNode(AstNode root, String code, String prefix, Type clazz) {
+ static AstNode findNode(AstNode root, String code, String prefix, Predicate<AstNode> predicate) {
int offset = code.indexOf(prefix);
if (offset == -1) {
throw new IllegalArgumentException("Not found '${prefix}'.");
}
AstNode node = new NodeLocator.con1(offset).searchWithin(root);
- return node.getAncestor(clazz);
+ return node.getAncestor(predicate);
}
static void assertContains2(List<Object> array, List<bool> found, Object element) {
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/code_transformers/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698