@@ -21,7 +21,6 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
21
21
import 'package:yaml/yaml.dart' ;
22
22
23
23
import '../../generated/test_support.dart' ;
24
- import '../../resource_utils.dart' ;
25
24
26
25
main () {
27
26
defineReflectiveSuite (() {
@@ -626,7 +625,6 @@ linter:
626
625
627
626
@reflectiveTest
628
627
class OptionsProviderTest with ResourceProviderMixin {
629
- late final TestPathTranslator pathTranslator;
630
628
late final SourceFactory sourceFactory;
631
629
632
630
late final AnalysisOptionsProvider provider;
@@ -644,9 +642,9 @@ class OptionsProviderTest with ResourceProviderMixin {
644
642
645
643
void assertErrorsInOptionsFile (
646
644
String code, List <ExpectedError > expectedErrors) async {
647
- pathTranslator. newFile (optionsFilePath, code);
645
+ newFile (optionsFilePath, code);
648
646
var errors = analyzeAnalysisOptions (
649
- sourceFactory.forUri ( 'file://$ optionsFilePath ' )! ,
647
+ sourceFactory.forUri2 ( toUri ( optionsFilePath) )! ,
650
648
code,
651
649
sourceFactory,
652
650
'/' ,
@@ -678,20 +676,19 @@ class OptionsProviderTest with ResourceProviderMixin {
678
676
679
677
void setUp () {
680
678
resourceProvider = MemoryResourceProvider ();
681
- pathTranslator = TestPathTranslator (resourceProvider);
682
679
sourceFactory = SourceFactory ([ResourceUriResolver (resourceProvider)]);
683
680
provider = AnalysisOptionsProvider (sourceFactory);
684
681
}
685
682
686
683
test_chooseFirstPlugin () {
687
- pathTranslator. newFile ('/more_options.yaml' , '''
684
+ newFile ('/more_options.yaml' , '''
688
685
analyzer:
689
686
plugins:
690
687
- plugin_ddd
691
688
- plugin_ggg
692
689
- plugin_aaa
693
690
''' );
694
- pathTranslator. newFile ('/other_options.yaml' , '''
691
+ newFile ('/other_options.yaml' , '''
695
692
include: more_options.yaml
696
693
analyzer:
697
694
plugins:
@@ -707,7 +704,7 @@ analyzer:
707
704
- plugin_iii
708
705
- plugin_ccc
709
706
''' ;
710
- pathTranslator. newFile (optionsFilePath, code);
707
+ newFile (optionsFilePath, code);
711
708
712
709
final options = _getOptionsObject ('/' );
713
710
expect (options.enabledPluginNames, unorderedEquals (['plugin_ddd' ]));
@@ -722,7 +719,7 @@ analyzer:
722
719
// TODO(https://github.com/dart-lang/sdk/issues/50980): add tests with
723
720
// duplicate plugin names.
724
721
725
- pathTranslator. newFile ('/other_options.yaml' , '''
722
+ newFile ('/other_options.yaml' , '''
726
723
analyzer:
727
724
exclude:
728
725
- toplevelexclude.dart
@@ -746,7 +743,7 @@ linter:
746
743
rules:
747
744
- lowlevellint
748
745
''' ;
749
- pathTranslator. newFile (optionsFilePath, code);
746
+ newFile (optionsFilePath, code);
750
747
751
748
final lowlevellint = TestRule .withName ('lowlevellint' );
752
749
final toplevellint = TestRule .withName ('toplevellint' );
@@ -769,7 +766,7 @@ linter:
769
766
}
770
767
771
768
test_multiplePlugins_firstIsDirectlyIncluded_secondIsDirect_listForm () {
772
- pathTranslator. newFile ('/other_options.yaml' , '''
769
+ newFile (convertPath ( '/other_options.yaml' ) , '''
773
770
analyzer:
774
771
plugins:
775
772
- plugin_one
@@ -785,7 +782,7 @@ analyzer:
785
782
}
786
783
787
784
test_multiplePlugins_firstIsDirectlyIncluded_secondIsDirect_mapForm () {
788
- pathTranslator. newFile ('/other_options.yaml' , '''
785
+ newFile ('/other_options.yaml' , '''
789
786
analyzer:
790
787
plugins:
791
788
- plugin_one
@@ -802,7 +799,7 @@ analyzer:
802
799
}
803
800
804
801
test_multiplePlugins_firstIsDirectlyIncluded_secondIsDirect_scalarForm () {
805
- pathTranslator. newFile ('/other_options.yaml' , '''
802
+ newFile ('/other_options.yaml' , '''
806
803
analyzer:
807
804
plugins:
808
805
- plugin_one
@@ -817,12 +814,12 @@ analyzer:
817
814
}
818
815
819
816
test_multiplePlugins_firstIsIndirectlyIncluded_secondIsDirect () {
820
- pathTranslator. newFile ('/more_options.yaml' , '''
817
+ newFile ('/more_options.yaml' , '''
821
818
analyzer:
822
819
plugins:
823
820
- plugin_one
824
821
''' );
825
- pathTranslator. newFile ('/other_options.yaml' , '''
822
+ newFile ('/other_options.yaml' , '''
826
823
include: more_options.yaml
827
824
''' );
828
825
assertErrorsInOptionsFile (r'''
@@ -836,12 +833,12 @@ analyzer:
836
833
}
837
834
838
835
test_multiplePlugins_firstIsIndirectlyIncluded_secondIsDirectlyIncluded () {
839
- pathTranslator. newFile ('/more_options.yaml' , '''
836
+ newFile ('/more_options.yaml' , '''
840
837
analyzer:
841
838
plugins:
842
839
- plugin_one
843
840
''' );
844
- pathTranslator. newFile ('/other_options.yaml' , '''
841
+ newFile ('/other_options.yaml' , '''
845
842
include: more_options.yaml
846
843
analyzer:
847
844
plugins:
@@ -908,7 +905,7 @@ analyzer:
908
905
}
909
906
910
907
List <AnalysisError > validate (String code, List <ErrorCode > expected) {
911
- pathTranslator. newFile (optionsFilePath, code);
908
+ newFile (optionsFilePath, code);
912
909
var errors = analyzeAnalysisOptions (
913
910
sourceFactory.forUri ('file://$optionsFilePath ' )! ,
914
911
code,
@@ -924,7 +921,7 @@ analyzer:
924
921
}
925
922
926
923
YamlMap _getOptions (String posixPath) {
927
- var resource = pathTranslator. getResource (posixPath) as Folder ;
924
+ var resource = getFolder (posixPath);
928
925
return provider.getOptions (resource);
929
926
}
930
927
0 commit comments