]> begriffs open source - sa-parse/blob - tests/meson.build
Remove old stray test files
[sa-parse] / tests / meson.build
1 # Use Meson's filesystem module for portable file operations
2 fs = import('fs')
3
4 # Define test categories with their properties
5 test_categories = {
6     'valid': {
7         'path': 'csv/valid',
8         'should_fail': false,
9     },
10     'invalid': {
11         'path': 'csv/invalid', 
12         'should_fail': true,
13     },
14     'stress': {
15         'path': 'csv/stress',
16         'should_fail': false,
17     }
18 }
19
20 # Auto-discover CSV files and create tests for each category
21 foreach category, props : test_categories
22     # Find CSV files for this category
23     files_result = run_command('find', props['path'], '-name', '*.csv', '-type', 'f', check: true)
24     file_list = files_result.stdout().strip().split('\n')
25     csv_files = files(file_list)
26     
27     # Create tests for each file in this category
28     foreach test_file : csv_files
29         # Extract filename without extension
30         test_name = fs.stem(test_file)
31         
32         # Create the test with conditional should_fail
33         if props['should_fail']
34             test('csv_parser_' + category + '_' + test_name,
35                 csv_parser,
36                 args: [test_file],
37                 workdir: meson.current_source_dir(),
38                 timeout: 5,
39                 should_fail: true,
40                 env: {'CSV_TEST_MODE': category})
41         else
42             test('csv_parser_' + category + '_' + test_name,
43                 csv_parser,
44                 args: [test_file],
45                 workdir: meson.current_source_dir(),
46                 timeout: 5,
47                 env: {'CSV_TEST_MODE': category})
48         endif
49     endforeach
50 endforeach