mirror of
https://github.com/benhoyt/inih.git
synced 2025-02-05 07:08:23 +08:00
Allows tests to use "meson test" instead of a shell script. This also means that they now fully respect user-specified toolchain (e.g. clang compiler, custom CFLAGS, etc). Running C++ test is conditional on enabling INIReader support in the build. ``` 1/16 test_multi OK 0.05s 2/16 test_multi_max_line OK 0.04s 3/16 test_single OK 0.04s 4/16 test_disallow_inline_comments OK 0.03s 5/16 test_stop_on_first_error OK 0.03s 6/16 test_handler_lineno OK 0.02s 7/16 test_heap OK 0.06s 8/16 test_string OK 0.06s 9/16 test_heap_max_line OK 0.05s 10/16 test_heap_realloc OK 0.05s 11/16 test_heap_realloc_max_line OK 0.05s 12/16 test_heap_string OK 0.04s 13/16 test_call_handler_on_new_section OK 0.04s 14/16 test_allow_no_value OK 0.03s 15/16 test_alloc OK 0.02s 16/16 test_INIReaderExample OK 0.02s Ok: 16 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0 ``` Co-authored-by: matoro <matoro@users.noreply.github.com>
26 lines
1.6 KiB
Meson
26 lines
1.6 KiB
Meson
runtest = files(join_paths(meson.project_source_root(), 'tests', 'runtest.sh'))
|
|
|
|
tests = {
|
|
'multi': { 'args': [] },
|
|
'multi_max_line': { 'args': ['-DINI_MAX_LINE=20'] },
|
|
'single': { 'args': ['-DINI_ALLOW_MULTILINE=0'] },
|
|
'disallow_inline_comments': { 'args': ['-DINI_ALLOW_INLINE_COMMENTS=0'] },
|
|
'stop_on_first_error': { 'args': ['-DINI_STOP_ON_FIRST_ERROR=1'] },
|
|
'handler_lineno': { 'args': ['-DINI_HANDLER_LINENO=1'] },
|
|
'string': { 'src': 'unittest_string.c', 'args': ['-DINI_MAX_LINE=20'] },
|
|
'heap': { 'args': ['-DINI_USE_STACK=0'] },
|
|
'heap_max_line': { 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20'] },
|
|
'heap_realloc': { 'args': ['-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5'] },
|
|
'heap_realloc_max_line': { 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5'] },
|
|
'heap_string': { 'src': 'unittest_string.c', 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20'] },
|
|
'call_handler_on_new_section': { 'args': ['-DINI_CALL_HANDLER_ON_NEW_SECTION=1'] },
|
|
'allow_no_value': { 'args': ['-DINI_ALLOW_NO_VALUE=1'] },
|
|
'alloc': { 'src': 'unittest_alloc.c', 'args': ['-DINI_CUSTOM_ALLOCATOR=1', '-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=12'] }
|
|
}
|
|
|
|
foreach name, properties : tests
|
|
test_src = 'src' in properties ? properties['src'] : 'unittest.c'
|
|
exe = executable('unittest_' + name, src_inih, test_src, c_args : ['-Wall', properties['args']])
|
|
test('test_' + name, runtest, depends : [exe], args : [files('baseline_' + name + '.txt'), exe.full_path()])
|
|
endforeach
|