OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 " void main(List<String> items) {", | 302 " void main(List<String> items) {", |
303 " JavaIterator<String> iter = new JavaIterator(items);", | 303 " JavaIterator<String> iter = new JavaIterator(items);", |
304 " if (iter.hasNext) {", | 304 " if (iter.hasNext) {", |
305 " iter.next();", | 305 " iter.next();", |
306 " iter.remove();", | 306 " iter.remove();", |
307 " }", | 307 " }", |
308 " }", | 308 " }", |
309 "}"); | 309 "}"); |
310 } | 310 } |
311 | 311 |
| 312 public void test_LinkedList() throws Exception { |
| 313 translateSingleFile( |
| 314 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 315 "package test;", |
| 316 "import java.util.List;", |
| 317 "import java.util.LinkedList;", |
| 318 "public class Test {", |
| 319 " public void test() {", |
| 320 " LinkedList<String> result = new LinkedList<String>();", |
| 321 " }", |
| 322 "}"); |
| 323 runProcessor(); |
| 324 assertFormattedSource( |
| 325 "class Test {", |
| 326 " void test() {", |
| 327 " Queue<String> result = new Queue<String>();", |
| 328 " }", |
| 329 "}"); |
| 330 } |
| 331 |
312 public void test_List_addAtIndex() throws Exception { | 332 public void test_List_addAtIndex() throws Exception { |
313 translateSingleFile( | 333 translateSingleFile( |
314 "// filler filler filler filler filler filler filler filler filler fille
r", | 334 "// filler filler filler filler filler filler filler filler filler fille
r", |
315 "package test;", | 335 "package test;", |
316 "import java.util.List;", | 336 "import java.util.List;", |
317 "public class Test {", | 337 "public class Test {", |
318 " public void foo(List<Integer> items) {", | 338 " public void foo(List<Integer> items) {", |
319 " items.add(2, 42);", | 339 " items.add(2, 42);", |
320 " }", | 340 " }", |
321 "}"); | 341 "}"); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 " void foo(Set<int> items) {", | 567 " void foo(Set<int> items) {", |
548 " javaSetAdd(items, 42);", | 568 " javaSetAdd(items, 42);", |
549 " }", | 569 " }", |
550 "}"); | 570 "}"); |
551 } | 571 } |
552 | 572 |
553 private void runProcessor() { | 573 private void runProcessor() { |
554 new CollectionSemanticProcessor(context).process(unit); | 574 new CollectionSemanticProcessor(context).process(unit); |
555 } | 575 } |
556 } | 576 } |
OLD | NEW |