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

Side by Side Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 332383006: Trigger re-analysis when a file changes on disk. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.domain.analysis; 5 library test.domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/computer/computer_highlights.dart'; 9 import 'package:analysis_server/src/computer/computer_highlights.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 NEW_LENGTH: 'lib'.length, 1579 NEW_LENGTH: 'lib'.length,
1580 }); 1580 });
1581 // wait, there is an error 1581 // wait, there is an error
1582 return helper.waitForOperationsFinished().then((_) { 1582 return helper.waitForOperationsFinished().then((_) {
1583 List<AnalysisError> errors = helper.getTestErrors(); 1583 List<AnalysisError> errors = helper.getTestErrors();
1584 expect(errors, hasLength(1)); 1584 expect(errors, hasLength(1));
1585 }); 1585 });
1586 }); 1586 });
1587 }); 1587 });
1588 1588
1589 test('change on disk', () { 1589 test('change on disk, normal', () {
1590 AnalysisTestHelper helper = new AnalysisTestHelper(); 1590 AnalysisTestHelper helper = new AnalysisTestHelper();
1591 helper.createSingleFileProject('library A;'); 1591 helper.createSingleFileProject('library A;');
1592 return helper.waitForOperationsFinished().then((_) { 1592 return helper.waitForOperationsFinished().then((_) {
1593 // There should be no errors
1594 expect(helper.getTestErrors(), hasLength(0));
1595 // Change file on disk, adding a syntax error.
1596 helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
1597 // There should be errors now.
1598 return pumpEventQueue().then((_) {
1599 return helper.waitForOperationsFinished().then((_) {
1600 expect(helper.getTestErrors(), hasLength(1));
1601 });
1602 });
1603 });
1604 });
1605
1606 test('change on disk, during override', () {
1607 AnalysisTestHelper helper = new AnalysisTestHelper();
1608 helper.createSingleFileProject('library A;');
1609 return helper.waitForOperationsFinished().then((_) {
1593 // update code 1610 // update code
1594 helper.sendContentChange({ 1611 helper.sendContentChange({
1595 CONTENT: 'library B;' 1612 CONTENT: 'library B;'
1596 }); 1613 });
1597 // There should be no errors 1614 // There should be no errors
1598 return helper.waitForOperationsFinished().then((_) { 1615 return helper.waitForOperationsFinished().then((_) {
1599 expect(helper.getTestErrors(), hasLength(0)); 1616 expect(helper.getTestErrors(), hasLength(0));
1600 // Change file on disk, adding a syntax error. 1617 // Change file on disk, adding a syntax error.
1601 helper.resourceProvider.modifyFile(helper.testFile, 'library lib'); 1618 helper.resourceProvider.modifyFile(helper.testFile, 'library lib');
1602 // There should still be no errors (file should not have been reread). 1619 // There should still be no errors (file should not have been reread).
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 // subscribe 1659 // subscribe
1643 helper.addAnalysisSubscriptionHighlights(helper.testFile); 1660 helper.addAnalysisSubscriptionHighlights(helper.testFile);
1644 // wait, has regions 1661 // wait, has regions
1645 return helper.waitForOperationsFinished().then((_) { 1662 return helper.waitForOperationsFinished().then((_) {
1646 var highlights = helper.getHighlights(helper.testFile); 1663 var highlights = helper.getHighlights(helper.testFile);
1647 expect(highlights, isNot(isEmpty)); 1664 expect(highlights, isNot(isEmpty));
1648 }); 1665 });
1649 }); 1666 });
1650 }); 1667 });
1651 } 1668 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698