Chromium Code Reviews| Index: pkg/analyzer/test/src/context/context_test.dart |
| diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart |
| index 583bc1f10ff3e41ea550677432451d9a86994228..b01e2b818c21017e48f68a48cd3b813a8b379d8b 100644 |
| --- a/pkg/analyzer/test/src/context/context_test.dart |
| +++ b/pkg/analyzer/test/src/context/context_test.dart |
| @@ -3103,6 +3103,53 @@ class C {} |
| expect(context.getErrors(b).errors, hasLength(1)); |
| } |
| + void test_sequence_inBodyChange_deltaChange() { |
|
Brian Wilkerson
2016/07/07 20:58:41
This will test that the newly referenced name gets
scheglov
2016/07/07 21:02:45
Good idea, thank you.
I've added a new test for th
|
| + Source a = addSource( |
| + '/a.dart', |
| + r''' |
| +class A { |
| +} |
| +'''); |
| + Source b = addSource( |
| + '/b.dart', |
| + r''' |
| +import 'a.dart'; |
| +main(A a) { |
| +} |
| +'''); |
| + _performPendingAnalysisTasks(); |
| + expect(context.getErrors(b).errors, hasLength(0)); |
| + // Update b.dart: in-body incremental change |
| + // Should update referenced names. |
| + context.setContents( |
| + b, |
| + r''' |
| +import 'a.dart'; |
| +main(A a) { |
| + a.foo; |
| +} |
| +'''); |
| + _performPendingAnalysisTasks(); |
| + expect(context.getErrors(b).errors, hasLength(1)); |
| + // Update a.dart: add A.foo |
| + // b.dart is invalid, because it references 'foo'. |
| + context.setContents( |
| + a, |
| + r''' |
| +class A { |
| + int foo; |
| +} |
| +'''); |
| + _assertValidForChangedLibrary(a); |
| + _assertInvalid(a, LIBRARY_ERRORS_READY); |
| + _assertValidForDependentLibrary(b); |
| + _assertInvalid(b, LIBRARY_ERRORS_READY); |
| + _assertInvalidUnits(b, RESOLVED_UNIT4); |
| + // No errors after analysis. |
| + _performPendingAnalysisTasks(); |
| + expect(context.getErrors(b).errors, hasLength(0)); |
| + } |
| + |
| void test_sequence_noChange_thenChange() { |
| Source a = addSource( |
| '/a.dart', |