Skip to content

Commit a908779

Browse files
authored
Update test logic for validating warnings (#1506)
pkg:build changed
1 parent d30c2fd commit a908779

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

json_serializable/test/annotation_version_test.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@Timeout.factor(2)
88
library;
99

10+
import 'dart:convert';
1011
import 'dart:io';
1112

1213
import 'package:json_serializable/src/check_dependencies.dart';
@@ -189,7 +190,7 @@ class SomeClass{}
189190

190191
final output = lines.toString();
191192
final expectedWarningCount = message == null ? 0 : 1;
192-
final warningCount = '[WARNING]'.allMatches(output).length;
193+
final warningCount = _warningStartOfLine.allMatches(output).length;
193194
expect(
194195
warningCount,
195196
expectedWarningCount,
@@ -202,10 +203,12 @@ class SomeClass{}
202203
expect(
203204
output,
204205
contains('''
205-
[WARNING] json_serializable on $sourceDirectory/sample.dart:
206-
$message'''),
206+
W json_serializable on $sourceDirectory/sample.dart:
207+
${LineSplitter.split(message).map((line) => ' $line').join('\n')}'''),
207208
);
208209
}
209210

210211
await proc.shouldExit(0);
211212
}
213+
214+
final _warningStartOfLine = RegExp(r'^W ', multiLine: true);

0 commit comments

Comments
 (0)