| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.analysis.updateContent; | 5 library test.analysis.updateContent; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
| 8 import 'package:analysis_server/src/protocol.dart'; | 8 import 'package:analysis_server/src/protocol.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ''') | 80 ''') |
| 81 }); | 81 }); |
| 82 return waitForTasksFinished(); | 82 return waitForTasksFinished(); |
| 83 }).then((_) { | 83 }).then((_) { |
| 84 // The overlay should have been propagated to both contexts, causing both | 84 // The overlay should have been propagated to both contexts, causing both |
| 85 // foo.dart and bar.dart to be reanalyzed and found to be free of errors. | 85 // foo.dart and bar.dart to be reanalyzed and found to be free of errors. |
| 86 expect(filesErrors[fooPath], isEmpty); | 86 expect(filesErrors[fooPath], isEmpty); |
| 87 expect(filesErrors[barPath], isEmpty); | 87 expect(filesErrors[barPath], isEmpty); |
| 88 }); | 88 }); |
| 89 } | 89 } |
| 90 |
| 91 test_sendNoticesAfterNopChange() async { |
| 92 createProject(); |
| 93 addTestFile(''); |
| 94 await server.onAnalysisComplete; |
| 95 // add an overlay |
| 96 server.updateContent('1', { |
| 97 testFile: new AddContentOverlay('main() {} main() {}') |
| 98 }); |
| 99 await server.onAnalysisComplete; |
| 100 // clear errors and make a no-op change |
| 101 filesErrors.clear(); |
| 102 server.updateContent('2', { |
| 103 testFile: new ChangeContentOverlay([new SourceEdit(0, 4, 'main')]) |
| 104 }); |
| 105 await server.onAnalysisComplete; |
| 106 // errors should have been resent |
| 107 expect(filesErrors, isNotEmpty); |
| 108 } |
| 109 |
| 110 test_sendNoticesAfterNopChange_flushedUnit() async { |
| 111 createProject(); |
| 112 addTestFile(''); |
| 113 await server.onAnalysisComplete; |
| 114 // add an overlay |
| 115 server.updateContent('1', { |
| 116 testFile: new AddContentOverlay('main() {} main() {}') |
| 117 }); |
| 118 await server.onAnalysisComplete; |
| 119 // clear errors and make a no-op change |
| 120 filesErrors.clear(); |
| 121 server.test_flushResolvedUnit(testFile); |
| 122 server.updateContent('2', { |
| 123 testFile: new ChangeContentOverlay([new SourceEdit(0, 4, 'main')]) |
| 124 }); |
| 125 await server.onAnalysisComplete; |
| 126 // errors should have been resent |
| 127 expect(filesErrors, isNotEmpty); |
| 128 } |
| 90 } | 129 } |
| OLD | NEW |