@@ -203,6 +203,50 @@ void main() {
203203 expect (exitCode, equals (1 ));
204204 expect (logBuffer.toString (), contains ('Error: FileSystemException' ));
205205 });
206+
207+ // New Test: Check execution of additional commands from config
208+ test (
209+ 'additional commands in config are appended to end of generation command.' ,
210+ () async {
211+ final mockCommands = 'validate generate' ;
212+ final configData = {
213+ ConfigKeys .openapiGeneratorVersion: '5.0.0' ,
214+ ConfigKeys .additionalCommands: mockCommands,
215+ ConfigKeys .jarCachePath: '.dart_tool/openapi_generator_cache' ,
216+ };
217+
218+ var executedCommands = < String > [];
219+ Future <void > mockExecuteWithClasspath (
220+ List <String > jarPaths, List <String > args) async {
221+ executedCommands.addAll (args);
222+ }
223+
224+ await runMain (
225+ arguments: ['gen' ],
226+ loadConfig: (p0) async => configData,
227+ downloadJar: (p0, p1) async {},
228+ executeWithClasspath: mockExecuteWithClasspath,
229+ log: (p0) => print (p0),
230+ );
231+
232+ // Verify commands executed from config
233+ expect (executedCommands, equals (['gen' , 'validate generate' ]));
234+ });
235+
236+ test ('ProcessRunner run method executes and prints out dart version' ,
237+ () async {
238+ // Define the expected input arguments
239+ const executable = 'dart' ;
240+ final arguments = ['--version' ];
241+
242+ // Create an instance of ProcessRunner
243+ final processRunner = ProcessRunner ();
244+
245+ // Execute the run method and verify the result
246+ final result = await processRunner.run (executable, arguments);
247+ expect (result.stdout, contains ('Dart SDK version' ));
248+ expect (result.exitCode, equals (0 ));
249+ });
206250}
207251
208252class TestProcessRunner extends ProcessRunner {
0 commit comments