OLD | NEW |
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.integration.analysis.update.content; | 5 library test.integration.analysis.update.content; |
6 | 6 |
7 import 'package:analysis_testing/reflective_tests.dart'; | 7 import 'package:analysis_testing/reflective_tests.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 | 9 |
10 import '../integration_tests.dart'; | 10 import '../integration_tests.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 'type': 'add', | 28 'type': 'add', |
29 'content': goodText | 29 'content': goodText |
30 } | 30 } |
31 })).then((result) => analysisFinished).then((_) { | 31 })).then((result) => analysisFinished).then((_) { |
32 // There should be no errors now because the contents on disk have been | 32 // There should be no errors now because the contents on disk have been |
33 // overriden with goodText. | 33 // overriden with goodText. |
34 expect(currentAnalysisErrors[pathname], isEmpty); | 34 expect(currentAnalysisErrors[pathname], isEmpty); |
35 return sendAnalysisUpdateContent({ | 35 return sendAnalysisUpdateContent({ |
36 pathname: { | 36 pathname: { |
37 'type': 'change', | 37 'type': 'change', |
38 'offset': goodText.indexOf(';'), | 38 'edits': [{ |
39 'length': 1, | 39 'offset': goodText.indexOf(';'), |
40 'replacement': '' | 40 'length': 1, |
| 41 'replacement': '' |
| 42 }] |
41 } | 43 } |
42 }); | 44 }); |
43 }).then((result) => analysisFinished).then((_) { | 45 }).then((result) => analysisFinished).then((_) { |
44 // There should be errors now because we've removed the semicolon. | 46 // There should be errors now because we've removed the semicolon. |
45 expect(currentAnalysisErrors[pathname], isNot(isEmpty)); | 47 expect(currentAnalysisErrors[pathname], isNot(isEmpty)); |
46 return sendAnalysisUpdateContent({ | 48 return sendAnalysisUpdateContent({ |
47 pathname: { | 49 pathname: { |
48 'type': 'change', | 50 'type': 'change', |
49 'offset': goodText.indexOf(';'), | 51 'edits': [{ |
50 'length': 0, | 52 'offset': goodText.indexOf(';'), |
51 'replacement': ';' | 53 'length': 0, |
| 54 'replacement': ';' |
| 55 }] |
52 } | 56 } |
53 }); | 57 }); |
54 }).then((result) => analysisFinished).then((_) { | 58 }).then((result) => analysisFinished).then((_) { |
55 // There should be no errors now because we've added the semicolon back. | 59 // There should be no errors now because we've added the semicolon back. |
56 expect(currentAnalysisErrors[pathname], isEmpty); | 60 expect(currentAnalysisErrors[pathname], isEmpty); |
57 return sendAnalysisUpdateContent({ | 61 return sendAnalysisUpdateContent({ |
58 pathname: { | 62 pathname: { |
59 'type': 'remove' | 63 'type': 'remove' |
60 } | 64 } |
61 }); | 65 }); |
62 }).then((result) => analysisFinished).then((_) { | 66 }).then((result) => analysisFinished).then((_) { |
63 // Now there should be errors again, because the contents on disk are no | 67 // Now there should be errors again, because the contents on disk are no |
64 // longer overridden. | 68 // longer overridden. |
65 expect(currentAnalysisErrors[pathname], isNot(isEmpty)); | 69 expect(currentAnalysisErrors[pathname], isNot(isEmpty)); |
66 }); | 70 }); |
67 } | 71 } |
68 } | 72 } |
69 | 73 |
70 main() { | 74 main() { |
71 runReflectiveTests(Test); | 75 runReflectiveTests(Test); |
72 } | 76 } |
OLD | NEW |