@@ -2690,14 +2690,27 @@ void main() {
26902690 },
26912691 );
26922692
2693- test ('creates dummy non-null Stream return value' , () async {
2693+ test ('creates dummy non-null RegExp return value' , () async {
26942694 await expectSingleNonNullableOutput (
26952695 dedent (r'''
26962696 abstract class Foo {
2697- Stream<int> m();
2697+ RegExp m();
26982698 }
26992699 ''' ),
2700- _containsAllOf ('returnValue: _i3.Stream<int>.empty()' ),
2700+ _containsAllOf ("returnValue: RegExp('')" ),
2701+ );
2702+ });
2703+
2704+ test ('creates dummy non-null MapEntry<int, String> return value' , () async {
2705+ await expectSingleNonNullableOutput (
2706+ dedent (r'''
2707+ abstract class Foo {
2708+ MapEntry<int, String> m();
2709+ }
2710+ ''' ),
2711+ _containsAllOf (
2712+ 'returnValue: MapEntry<int, String>(0, _i3.dummyValue<String>(' ,
2713+ ),
27012714 );
27022715 });
27032716
@@ -4340,23 +4353,20 @@ Future<void> _expectBuilderThrows({
43404353/// Dedent [input] , so that each line is shifted to the left, so that the first
43414354/// line is at the 0 column.
43424355String dedent (String input) {
4343- final indentMatch = RegExp (r'^(\s*)' ).firstMatch (input)! ;
4344- final indent = '' .padRight (indentMatch.group (1 )! .length);
4345- return input.splitMapJoin (
4346- '\n ' ,
4347- onNonMatch: (s) => s.replaceFirst (RegExp ('^$indent ' ), '' ),
4348- );
4356+ final indentMatch = RegExp (r'^\s*' ).firstMatch (input)! ;
4357+ if (indentMatch.end == 0 ) return input;
4358+ final indent = indentMatch[0 ]! ;
4359+ return input.replaceAll (RegExp ('^$indent ' , multiLine: true ), '' );
43494360}
43504361
43514362/// Dedent [input] , so that each line is shifted to the left, so that the first
43524363/// line is at column 2 (starting position for a class member).
43534364String dedent2 (String input) {
4354- final indentMatch = RegExp (r'^ (\s*)' ).firstMatch (input)! ;
4355- final indent = '' .padRight (indentMatch.group (1 )! .length);
4356- return input
4357- .replaceFirst (RegExp (r'\s*$' ), '' )
4358- .splitMapJoin (
4359- '\n ' ,
4360- onNonMatch: (s) => s.replaceFirst (RegExp ('^$indent ' ), '' ),
4361- );
4365+ final indentMatch = RegExp (r'^\s{2,}' ).firstMatch (input)! ;
4366+ if (indentMatch.end == 0 ) return input;
4367+ final indent = indentMatch[0 ];
4368+ return input.trimRight ().replaceAll (
4369+ RegExp ('^$indent ' , multiLine: true ),
4370+ ' ' ,
4371+ );
43624372}
0 commit comments