Chromium Code Reviews| 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/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 { | 548 { |
| 549 CompilationUnitElement unitElement = partUnits[1].element; | 549 CompilationUnitElement unitElement = partUnits[1].element; |
| 550 expect(unitElement.uri, 'part2.dart'); | 550 expect(unitElement.uri, 'part2.dart'); |
| 551 expect(unitElement.uriOffset, 37); | 551 expect(unitElement.uriOffset, 37); |
| 552 expect(unitElement.uriEnd, 49); | 552 expect(unitElement.uriEnd, 49); |
| 553 expect((libraryUnit.directives[2] as PartDirective).element, | 553 expect((libraryUnit.directives[2] as PartDirective).element, |
| 554 same(unitElement)); | 554 same(unitElement)); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 | 557 |
| 558 test_perform_error_missingLibraryDirectiveWithPart() { | 558 test_perform_error_missingLibraryDirectiveWithPart_hasCommon() { |
| 559 _performBuildTask({ | 559 _performBuildTask({ |
| 560 '/lib.dart': ''' | 560 '/lib.dart': ''' |
| 561 part 'part.dart'; | 561 part 'partA.dart'; |
| 562 part 'partB.dart'; | |
| 562 ''', | 563 ''', |
| 563 '/part.dart': ''' | 564 '/partA.dart': ''' |
| 564 part of lib; | 565 part of my_lib; |
| 566 ''', | |
| 567 '/partB.dart': ''' | |
| 568 part of my_lib; | |
| 565 ''' | 569 ''' |
| 566 }); | 570 }); |
| 567 _assertErrorsWithCodes( | 571 _assertErrorsWithCodes( |
| 568 [ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART]); | 572 [ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART]); |
| 573 AnalysisErrorWithProperties error = errorListener.errors[0]; | |
|
Brian Wilkerson
2015/03/15 23:28:14
"AnalysisErrorWithProperties" --> "AnalysisError"
scheglov
2015/03/15 23:38:15
Done.
| |
| 574 expect(error.getProperty(ErrorProperty.PARTS_LIBRARY_NAME), 'my_lib'); | |
| 575 } | |
| 576 | |
| 577 test_perform_error_missingLibraryDirectiveWithPart_noCommon() { | |
| 578 _performBuildTask({ | |
| 579 '/lib.dart': ''' | |
| 580 part 'partA.dart'; | |
| 581 part 'partB.dart'; | |
| 582 ''', | |
| 583 '/partA.dart': ''' | |
| 584 part of libA; | |
| 585 ''', | |
| 586 '/partB.dart': ''' | |
| 587 part of libB; | |
| 588 ''' | |
| 589 }); | |
| 590 _assertErrorsWithCodes( | |
| 591 [ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART]); | |
| 592 AnalysisErrorWithProperties error = errorListener.errors[0]; | |
|
Brian Wilkerson
2015/03/15 23:28:14
"AnalysisErrorWithProperties" --> "AnalysisError"
scheglov
2015/03/15 23:38:15
Done.
| |
| 593 expect(error.getProperty(ErrorProperty.PARTS_LIBRARY_NAME), isNull); | |
| 569 } | 594 } |
| 570 | 595 |
| 571 test_perform_error_partOfDifferentLibrary() { | 596 test_perform_error_partOfDifferentLibrary() { |
| 572 _performBuildTask({ | 597 _performBuildTask({ |
| 573 '/lib.dart': ''' | 598 '/lib.dart': ''' |
| 574 library lib; | 599 library lib; |
| 575 part 'part.dart'; | 600 part 'part.dart'; |
| 576 ''', | 601 ''', |
| 577 '/part.dart': ''' | 602 '/part.dart': ''' |
| 578 part of someOtherLib; | 603 part of someOtherLib; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 return entryMap.putIfAbsent(target, () => new CacheEntry()); | 1014 return entryMap.putIfAbsent(target, () => new CacheEntry()); |
| 990 } | 1015 } |
| 991 | 1016 |
| 992 TimestampedData<String> getContents(Source source) => source.contents; | 1017 TimestampedData<String> getContents(Source source) => source.contents; |
| 993 | 1018 |
| 994 noSuchMethod(Invocation invocation) { | 1019 noSuchMethod(Invocation invocation) { |
| 995 print('noSuchMethod: ${invocation.memberName}'); | 1020 print('noSuchMethod: ${invocation.memberName}'); |
| 996 return super.noSuchMethod(invocation); | 1021 return super.noSuchMethod(invocation); |
| 997 } | 1022 } |
| 998 } | 1023 } |
| OLD | NEW |