Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Commit 7bed519

Browse files
committed
fixes unit test about main-mock
by ensuring .cpp_linter_cache folder exists during unit test. also don't parse empty XML data; return early instead.
1 parent de577a6 commit 7bed519

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/clang_format.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class FormatFix {
143143
/// Parse the [xmlOut] from running clang-format on a single [file].
144144
FormatFix parseFormatReplacementsXml(String xmlOut, FileObj file) {
145145
FormatFix advice = FormatFix(file);
146+
if (xmlOut.isEmpty) return advice;
146147
final document = XmlDocument.parse(xmlOut);
147148
for (final child in document.root.findAllElements('replacement')) {
148149
var offset = int.parse(

test/run_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void main() async {
5959
.toList();
6060
final (ignored, notIgnored) = parseIgnoredOption(args['ignore']);
6161
final files = listSourceFiles(ext, ignored, notIgnored);
62+
Directory('.cpp_linter_cache').createSync();
6263
final (formatAdvice, _, tidyNotes) = await captureClangToolsOutput(
6364
files,
6465
args['version'],

0 commit comments

Comments
 (0)