| 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.src.task.dart_test; | 5 library test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/context/cache.dart'; | 7 import 'package:analyzer/src/context/cache.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 | 1462 |
| 1463 test_descriptor() { | 1463 test_descriptor() { |
| 1464 TaskDescriptor descriptor = ParseDartTask.DESCRIPTOR; | 1464 TaskDescriptor descriptor = ParseDartTask.DESCRIPTOR; |
| 1465 expect(descriptor, isNotNull); | 1465 expect(descriptor, isNotNull); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 test_perform() { | 1468 test_perform() { |
| 1469 _performParseTask(r''' | 1469 _performParseTask(r''' |
| 1470 part of lib; | 1470 part of lib; |
| 1471 class B {}'''); | 1471 class B {}'''); |
| 1472 expect(outputs, hasLength(7)); | 1472 expect(outputs, hasLength(8)); |
| 1473 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); |
| 1473 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); | 1474 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); |
| 1474 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); | 1475 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); |
| 1475 expect(outputs[INCLUDED_PARTS], hasLength(0)); | 1476 expect(outputs[INCLUDED_PARTS], hasLength(0)); |
| 1476 expect(outputs[PARSE_ERRORS], hasLength(0)); | 1477 expect(outputs[PARSE_ERRORS], hasLength(0)); |
| 1477 expect(outputs[PARSED_UNIT], isNotNull); | 1478 expect(outputs[PARSED_UNIT], isNotNull); |
| 1478 expect(outputs[SOURCE_KIND], SourceKind.PART); | 1479 expect(outputs[SOURCE_KIND], SourceKind.PART); |
| 1479 expect(outputs[UNITS], hasLength(1)); | 1480 expect(outputs[UNITS], hasLength(1)); |
| 1480 } | 1481 } |
| 1481 | 1482 |
| 1482 test_perform_invalidDirectives() { | 1483 test_perform_invalidDirectives() { |
| 1483 _performParseTask(r''' | 1484 _performParseTask(r''' |
| 1484 library lib; | 1485 library lib; |
| 1485 import '/does/not/exist.dart'; | 1486 import '/does/not/exist.dart'; |
| 1486 import '://invaliduri.dart'; | 1487 import '://invaliduri.dart'; |
| 1487 export '${a}lib3.dart'; | 1488 export '${a}lib3.dart'; |
| 1488 part 'part.dart'; | 1489 part 'part.dart'; |
| 1489 class A {}'''); | 1490 class A {}'''); |
| 1490 expect(outputs, hasLength(7)); | 1491 expect(outputs, hasLength(8)); |
| 1492 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(1)); |
| 1491 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); | 1493 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); |
| 1492 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2); | 1494 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2); |
| 1493 expect(outputs[INCLUDED_PARTS], hasLength(1)); | 1495 expect(outputs[INCLUDED_PARTS], hasLength(1)); |
| 1494 expect(outputs[PARSE_ERRORS], hasLength(2)); | 1496 expect(outputs[PARSE_ERRORS], hasLength(2)); |
| 1495 expect(outputs[PARSED_UNIT], isNotNull); | 1497 expect(outputs[PARSED_UNIT], isNotNull); |
| 1496 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); | 1498 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); |
| 1497 expect(outputs[UNITS], hasLength(2)); | 1499 expect(outputs[UNITS], hasLength(2)); |
| 1498 } | 1500 } |
| 1499 | 1501 |
| 1500 test_perform_library() { | 1502 test_perform_library() { |
| 1501 _performParseTask(r''' | 1503 _performParseTask(r''' |
| 1502 library lib; | 1504 library lib; |
| 1503 import 'lib2.dart'; | 1505 import 'lib2.dart'; |
| 1504 export 'lib3.dart'; | 1506 export 'lib3.dart'; |
| 1505 part 'part.dart'; | 1507 part 'part.dart'; |
| 1506 class A {'''); | 1508 class A {'''); |
| 1507 expect(outputs, hasLength(7)); | 1509 expect(outputs, hasLength(8)); |
| 1510 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(1)); |
| 1508 expect(outputs[EXPORTED_LIBRARIES], hasLength(1)); | 1511 expect(outputs[EXPORTED_LIBRARIES], hasLength(1)); |
| 1509 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2); | 1512 _assertHasCore(outputs[IMPORTED_LIBRARIES], 2); |
| 1510 expect(outputs[INCLUDED_PARTS], hasLength(1)); | 1513 expect(outputs[INCLUDED_PARTS], hasLength(1)); |
| 1511 expect(outputs[PARSE_ERRORS], hasLength(1)); | 1514 expect(outputs[PARSE_ERRORS], hasLength(1)); |
| 1512 expect(outputs[PARSED_UNIT], isNotNull); | 1515 expect(outputs[PARSED_UNIT], isNotNull); |
| 1513 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); | 1516 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); |
| 1514 expect(outputs[UNITS], hasLength(2)); | 1517 expect(outputs[UNITS], hasLength(2)); |
| 1515 } | 1518 } |
| 1516 | 1519 |
| 1517 test_perform_useMemento() { | 1520 test_perform_useMemento() { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 /** | 1906 /** |
| 1904 * Fill [errorListener] with [result] errors in the current [task]. | 1907 * Fill [errorListener] with [result] errors in the current [task]. |
| 1905 */ | 1908 */ |
| 1906 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 1909 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 1907 List<AnalysisError> errors = task.outputs[result]; | 1910 List<AnalysisError> errors = task.outputs[result]; |
| 1908 expect(errors, isNotNull, reason: result.name); | 1911 expect(errors, isNotNull, reason: result.name); |
| 1909 errorListener = new GatheringErrorListener(); | 1912 errorListener = new GatheringErrorListener(); |
| 1910 errorListener.addAll(errors); | 1913 errorListener.addAll(errors); |
| 1911 } | 1914 } |
| 1912 } | 1915 } |
| OLD | NEW |