Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stopped relying on the commandline argument for build commands since
CI runs it differently
  • Loading branch information
gaaclarke committed Nov 8, 2022
commit 06daf81a34ef6e84496e4c1b4759e14074a4412b
29 changes: 21 additions & 8 deletions tools/clang_tidy/test/clang_tidy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io' as io show File, Platform, stderr;
import 'dart:io' as io show Directory, File, Platform, stderr;

import 'package:clang_tidy/clang_tidy.dart';
import 'package:clang_tidy/src/command.dart';
Expand Down Expand Up @@ -116,14 +116,27 @@ Future<int> main(List<String> args) async {
));
});

void _withTempFile(String prefix, void Function(String path) func) {
final String filePath = path.join(io.Directory.systemTemp.path, '$prefix-temp-file');
final io.File file = io.File(filePath);
file.createSync();
try {
func(file.path);
} finally {
file.deleteSync();
}
}

test('shard-id valid', () async {
final String variant = path.basename(io.File(buildCommands).parent.path);
final Options options = Options.fromCommandLine( <String>[
'--shard-variants=$variant',
'--shard-id=1',
],);
expect(options.errorMessage, isNull);
expect(options.shardId, equals(1));
_withTempFile('shard-id-valid', (String path) {
final Options options = Options.fromCommandLine( <String>[
'--compile-commands=$path',
'--shard-variants=variant',
'--shard-id=1',
],);
expect(options.errorMessage, isNull);
expect(options.shardId, equals(1));
});
});

test('shard-id invalid', () async {
Expand Down