# Use Meson's filesystem module for portable file operations fs = import('fs') # Define test categories with their properties test_categories = { 'valid': { 'path': 'csv/valid', 'should_fail': false, }, 'invalid': { 'path': 'csv/invalid', 'should_fail': true, }, 'stress': { 'path': 'csv/stress', 'should_fail': false, } } # Auto-discover CSV files and create tests for each category foreach category, props : test_categories # Find CSV files for this category files_result = run_command('find', props['path'], '-name', '*.csv', '-type', 'f', check: true) file_list = files_result.stdout().strip().split('\n') csv_files = files(file_list) # Create tests for each file in this category foreach test_file : csv_files # Extract filename without extension test_name = fs.stem(test_file) # Create the test with conditional should_fail if props['should_fail'] test('csv_parser_' + category + '_' + test_name, csv_parser, args: [test_file], workdir: meson.current_source_dir(), timeout: 5, should_fail: true, env: {'CSV_TEST_MODE': category}) else test('csv_parser_' + category + '_' + test_name, csv_parser, args: [test_file], workdir: meson.current_source_dir(), timeout: 5, env: {'CSV_TEST_MODE': category}) endif endforeach endforeach