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 analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 TestSource source = new TestSource(); | 98 TestSource source = new TestSource(); |
99 String content = ""; | 99 String content = ""; |
100 ChangeSet changeSet = new ChangeSet(); | 100 ChangeSet changeSet = new ChangeSet(); |
101 changeSet.changedContent(source, content); | 101 changeSet.changedContent(source, content); |
102 expect(changeSet.addedSources, hasLength(0)); | 102 expect(changeSet.addedSources, hasLength(0)); |
103 expect(changeSet.changedSources, hasLength(0)); | 103 expect(changeSet.changedSources, hasLength(0)); |
104 Map<Source, String> map = changeSet.changedContents; | 104 Map<Source, String> map = changeSet.changedContents; |
105 expect(map, hasLength(1)); | 105 expect(map, hasLength(1)); |
106 expect(map[source], same(content)); | 106 expect(map[source], same(content)); |
107 expect(changeSet.changedRanges, hasLength(0)); | 107 expect(changeSet.changedRanges, hasLength(0)); |
108 expect(changeSet.deletedSources, hasLength(0)); | |
109 expect(changeSet.removedSources, hasLength(0)); | 108 expect(changeSet.removedSources, hasLength(0)); |
110 expect(changeSet.removedContainers, hasLength(0)); | 109 expect(changeSet.removedContainers, hasLength(0)); |
111 } | 110 } |
112 | 111 |
113 void test_changedRange() { | 112 void test_changedRange() { |
114 TestSource source = new TestSource(); | 113 TestSource source = new TestSource(); |
115 String content = ""; | 114 String content = ""; |
116 ChangeSet changeSet = new ChangeSet(); | 115 ChangeSet changeSet = new ChangeSet(); |
117 changeSet.changedRange(source, content, 1, 2, 3); | 116 changeSet.changedRange(source, content, 1, 2, 3); |
118 expect(changeSet.addedSources, hasLength(0)); | 117 expect(changeSet.addedSources, hasLength(0)); |
119 expect(changeSet.changedSources, hasLength(0)); | 118 expect(changeSet.changedSources, hasLength(0)); |
120 expect(changeSet.changedContents, hasLength(0)); | 119 expect(changeSet.changedContents, hasLength(0)); |
121 Map<Source, ChangeSet_ContentChange> map = changeSet.changedRanges; | 120 Map<Source, ChangeSet_ContentChange> map = changeSet.changedRanges; |
122 expect(map, hasLength(1)); | 121 expect(map, hasLength(1)); |
123 ChangeSet_ContentChange change = map[source]; | 122 ChangeSet_ContentChange change = map[source]; |
124 expect(change, isNotNull); | 123 expect(change, isNotNull); |
125 expect(change.contents, content); | 124 expect(change.contents, content); |
126 expect(change.offset, 1); | 125 expect(change.offset, 1); |
127 expect(change.oldLength, 2); | 126 expect(change.oldLength, 2); |
128 expect(change.newLength, 3); | 127 expect(change.newLength, 3); |
129 expect(changeSet.deletedSources, hasLength(0)); | |
130 expect(changeSet.removedSources, hasLength(0)); | 128 expect(changeSet.removedSources, hasLength(0)); |
131 expect(changeSet.removedContainers, hasLength(0)); | 129 expect(changeSet.removedContainers, hasLength(0)); |
132 } | 130 } |
133 | 131 |
134 void test_toString() { | 132 void test_toString() { |
135 ChangeSet changeSet = new ChangeSet(); | 133 ChangeSet changeSet = new ChangeSet(); |
136 changeSet.addedSource(new TestSource()); | 134 changeSet.addedSource(new TestSource()); |
137 changeSet.changedSource(new TestSource()); | 135 changeSet.changedSource(new TestSource()); |
138 changeSet.changedContent(new TestSource(), ""); | 136 changeSet.changedContent(new TestSource(), ""); |
139 changeSet.changedRange(new TestSource(), "", 0, 0, 0); | 137 changeSet.changedRange(new TestSource(), "", 0, 0, 0); |
140 changeSet.deletedSource(new TestSource()); | |
141 changeSet.removedSource(new TestSource()); | 138 changeSet.removedSource(new TestSource()); |
142 changeSet | 139 changeSet |
143 .removedContainer(new SourceContainer_ChangeSetTest_test_toString()); | 140 .removedContainer(new SourceContainer_ChangeSetTest_test_toString()); |
144 expect(changeSet.toString(), isNotNull); | 141 expect(changeSet.toString(), isNotNull); |
145 } | 142 } |
146 } | 143 } |
147 | 144 |
148 @reflectiveTest | 145 @reflectiveTest |
149 class DisableAsyncTestCase extends ResolverTestCase { | 146 class DisableAsyncTestCase extends ResolverTestCase { |
150 @override | 147 @override |
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3379 */ | 3376 */ |
3380 class _StaleElement extends ElementImpl { | 3377 class _StaleElement extends ElementImpl { |
3381 _StaleElement() : super("_StaleElement", -1); | 3378 _StaleElement() : super("_StaleElement", -1); |
3382 | 3379 |
3383 @override | 3380 @override |
3384 get kind => throw "_StaleElement's kind shouldn't be accessed"; | 3381 get kind => throw "_StaleElement's kind shouldn't be accessed"; |
3385 | 3382 |
3386 @override | 3383 @override |
3387 accept(_) => throw "_StaleElement shouldn't be visited"; | 3384 accept(_) => throw "_StaleElement shouldn't be visited"; |
3388 } | 3385 } |
OLD | NEW |