* test that long sections are truncated
at MAX_SECTION=50
* generated .txt executing unittest.sh
* expected result
* Sections will be ignores when len(section) > len(INI_MAX_LINE)
---------
Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
* tests: define only once the compiler and flag
This way you could play with them easily. For example:
- use clang instead gcc
- -Wextra
- -fsanitize=address
* check CC environ and fallback to gcc
Can be used in continious integration
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>
Compilers differ on what the default standard is and I had to set C++11 standard as part of the [vcpkg port](https://github.com/microsoft/vcpkg/pull/33001) to get it work on MacOS.
Also you forgot to bump the version number last release.
Code context (ini.c):
101: #if INI_USE_STACK
102: char line[INI_MAX_LINE];
103: int max_line = INI_MAX_LINE;
104: #else
105: char* line;
106: size_t max_line = INI_INITIAL_ALLOC;
107: #endif
...
133: while (reader(line, (int)max_line, stream) != NULL) {
SonarCloud is reporting a "code smell" due to a redundant cast to `int` at line
133. This only happens when INI_USE_STACK is true, and not otherwise, as in that
case, `max_line` is of type `size_t` that gets correctly casted to `int`.
This patch changes the type of `max_line` variable to `size_t` for all situations.
SonarCloud report URL:
https://sonarcloud.io/project/issues?pullRequest=221&issues=AYGYdhPZKkhmUWy1nsvP&open=AYGYdhPZKkhmUWy1nsvP&id=snoopy
Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
* meson: enable distro settings by default
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
* meson: add note about version in pkg-config file
See also #123.
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
Meson doesn't have a `str` function, so it's not possible to change the integer options.
`subprojects/inih/meson.build:50:8: ERROR: Unknown function "str".`