1 # Use Meson's filesystem module for portable file operations
4 # Define test categories with their properties
5 csv_test_categories = {
11 'path': 'csv/invalid',
16 ical_test_categories = {
22 'path': 'ical/invalid',
27 # Auto-discover CSV files and create tests for each category
28 foreach category, props : csv_test_categories
29 # Find CSV files for this category
30 files_result = run_command('find', props['path'], '-name', '*.csv', '-type', 'f', check: true)
31 file_list = files_result.stdout().strip().split('\n')
32 csv_files = files(file_list)
34 # Create tests for each file in this category
35 foreach test_file : csv_files
36 # Extract filename without extension
37 test_name = fs.stem(test_file)
39 # Create the test with conditional should_fail
40 if props['should_fail']
41 test('csv_parser_' + category + '_' + test_name,
44 workdir: meson.current_source_dir(),
47 env: {'CSV_TEST_MODE': category})
49 test('csv_parser_' + category + '_' + test_name,
52 workdir: meson.current_source_dir(),
54 env: {'CSV_TEST_MODE': category})
59 # Auto-discover iCalendar files and create tests for each category
60 foreach category, props : ical_test_categories
61 # Find iCalendar files for this category
62 files_result = run_command('find', props['path'], '-name', '*.ics', '-type', 'f', check: true)
63 file_list = files_result.stdout().strip().split('\n')
64 ical_files = files(file_list)
66 # Create tests for each file in this category
67 foreach test_file : ical_files
68 # Extract filename without extension
69 test_name = fs.stem(test_file)
71 # Create the test with conditional should_fail
72 if props['should_fail']
73 test('ical_parser_' + category + '_' + test_name,
76 workdir: meson.current_source_dir(),
79 env: {'ICAL_TEST_MODE': category})
81 test('ical_parser_' + category + '_' + test_name,
84 workdir: meson.current_source_dir(),
86 env: {'ICAL_TEST_MODE': category})