Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 80eb9b5

Browse files
committed
made the negative test more specific
1 parent 06daf81 commit 80eb9b5

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

tools/clang_tidy/test/clang_tidy_test.dart

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,22 @@ void _withTempFile(String prefix, void Function(String path) func) {
140140
});
141141

142142
test('shard-id invalid', () async {
143-
final String variant = path.basename(io.File(buildCommands).parent.path);
144-
final Options options = Options.fromCommandLine( <String>[
145-
'--shard-variants=$variant',
143+
_withTempFile('shard-id-valid', (String path) {
144+
final StringBuffer errBuffer = StringBuffer();
145+
final Options options = Options.fromCommandLine(<String>[
146+
'--compile-commands=$path',
147+
'--shard-variants=variant',
146148
'--shard-id=2',
147-
],);
148-
expect(options.errorMessage, isNotNull);
149-
expect(options.shardId, isNull);
149+
], errSink: errBuffer);
150+
expect(options.errorMessage, isNotNull);
151+
expect(options.shardId, isNull);
152+
print('foo ${options.errorMessage}');
153+
expect(
154+
options.errorMessage,
155+
contains(
156+
'Invalid shard-id value',
157+
));
158+
});
150159
});
151160

152161
test('Error when --compile-commands path does not exist', () async {

0 commit comments

Comments
 (0)