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

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

Issue 752483002: More tests for expressions inside methods, constructors, initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index 3701dd8c01eaf57486420dcf49ac81df760fc153..3de9dcf28d1d9caf987b25451a29c120c248f520 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -846,6 +846,50 @@ main(int a, int b) {
'''), _isBlock);
}
+ void test_constructor_body() {
+ _resolveUnit(r'''
+class A {
+ int f;
+ A(int a, int b) {
+ f = a + b;
+ }
+}''');
+ _resolve(_editString('+', '*'), _isFunctionBody);
+ }
+
+ void test_constructor_fieldInitializer_edit() {
+ _resolveUnit(r'''
+class A {
+ int f;
+ A(int a, int b) : f = a + b {
+ int a = 42;
+ }
+}''');
+ _resolve(_editString('+', '*'), _isExpression);
+ }
+
+ void fail_test_constructor_fieldInitializer_add() {
+ // TODO(scheglov) resolver uses "enclosingClass", which we don't set yet
+ _resolveUnit(r'''
+class A {
+ int f;
+ A(int a, int b);
+}''');
+ _resolve(_editString(');', ') : f = a + b;'), _isClassMember);
+ }
+
+ void test_constructor_superConstructorInvocation() {
+ _resolveUnit(r'''
+class A {
+ A(int p);
+}
+class A {
+ A(int a, int b) : super(a + b);
+}
+''');
+ _resolve(_editString('+', '*'), _isExpression);
+ }
+
void test_functionBody_body() {
_resolveUnit(r'''
main(int a, int b) {
@@ -854,6 +898,13 @@ main(int a, int b) {
_resolve(_editString('+', '*'), _isFunctionBody);
}
+ void test_functionBody_expression() {
+ _resolveUnit(r'''
+main(int a, int b) => a + b;
+''');
+ _resolve(_editString('+', '*'), _isExpression);
+ }
+
void test_functionBody_statement() {
_resolveUnit(r'''
main(int a, int b) {
@@ -862,6 +913,23 @@ main(int a, int b) {
_resolve(_editString('+', '*'), _isStatement);
}
+ void test_method_body() {
+ _resolveUnit(r'''
+class A {
+ m(int a, int b) {
+ return a + b;
+ }
+}''');
+ _resolve(_editString('+', '*'), _isFunctionBody);
+ }
+
+ void test_topLevelVariable_initializer() {
+ _resolveUnit(r'''
+int C = 1 + 2;
+''');
+ _resolve(_editString('+', '*'), _isExpression);
+ }
+
void test_updateElementOffset() {
_resolveUnit(r'''
class A {
@@ -950,6 +1018,10 @@ class B {
static bool _isBlock(AstNode node) => node is Block;
+ static bool _isExpression(AstNode node) => node is Expression;
+
+ static bool _isClassMember(AstNode node) => node is ClassMember;
+
static bool _isFunctionBody(AstNode node) => node is FunctionBody;
static bool _isStatement(AstNode node) => node is Statement;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698