@@ -643,7 +643,7 @@ void main() {
643643 ]));
644644 });
645645
646- test ('fails if swift-format lint fails ' , () async {
646+ test ('fails if swift-format lint finds issues ' , () async {
647647 const List <String > files = < String > [
648648 'macos/foo.swift' ,
649649 ];
@@ -675,7 +675,43 @@ void main() {
675675 expect (
676676 output,
677677 containsAllInOrder (< Matcher > [
678- contains ('Failed to lint Swift files: exit code 1.' ),
678+ contains ('Swift linter found issues. See above for linter output.' ),
679+ ]));
680+ });
681+
682+ test ('fails if swift-format lint fails' , () async {
683+ const List <String > files = < String > [
684+ 'macos/foo.swift' ,
685+ ];
686+ final RepositoryPackage plugin =
687+ createFakePlugin ('a_plugin' , packagesDir, extraFiles: files);
688+ fakePubGet (plugin);
689+
690+ processRunner.mockProcessesForExecutable['swift-format' ] =
691+ < FakeProcessInfo > [
692+ FakeProcessInfo (MockProcess (),
693+ < String > ['--version' ]), // check for working swift-format
694+ FakeProcessInfo (MockProcess (), < String > ['-i' ]),
695+ FakeProcessInfo (MockProcess (exitCode: 99 ), < String > [
696+ 'lint' ,
697+ '--parallel' ,
698+ '--strict' ,
699+ ]),
700+ ];
701+ Error ? commandError;
702+ final List <String > output = await runCapturingPrint (runner, < String > [
703+ 'format' ,
704+ '--swift' ,
705+ '--swift-format-path=swift-format'
706+ ], errorHandler: (Error e) {
707+ commandError = e;
708+ });
709+
710+ expect (commandError, isA <ToolExit >());
711+ expect (
712+ output,
713+ containsAllInOrder (< Matcher > [
714+ contains ('Failed to lint Swift files: exit code 99.' ),
679715 ]));
680716 });
681717
0 commit comments