1
0
mirror of https://github.com/benhoyt/inih.git synced 2025-01-28 22:52:54 +08:00

33 Commits

Author SHA1 Message Date
Ben Hoyt
63a302cfe5 Comment tweaks; Subversion -> Git (about time!) 2024-10-27 10:15:33 +01:00
Isidro
f93ad9312e
Test that long sections are truncated (#180)
* 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>
2024-10-27 09:52:11 +01:00
Isidro
5f8fdf2509
tests: define only once the compiler and flag (#179)
* 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
2024-10-24 07:21:07 +02:00
matoro
ed4525140d
Add meson support for tests (#170)
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>
2024-06-12 09:47:53 +12:00
Ben Hoyt
bd798c5377
Make inline comments work on subsequent lines of multiline values (#140)
This is a bug fix that makes inih's behaviour here work as per Python's
ConfigParser, which is what inih behaviour is (loosely) based on.

Thanks @silly2020 for the report. See
https://github.com/benhoyt/inih/issues/120#issuecomment-1181341960
2022-07-12 21:20:05 +12:00
Ben Hoyt
ef9da8f4f7
Use "gcc -Wall" when running tests (#139) 2022-07-12 21:11:30 +12:00
Ben Hoyt
0b9092e80a Revert test baseline tweak 2021-02-27 17:22:53 +13:00
Ben Hoyt
2f1ee9b1c9 Modify test baseline to ensure GH Actions fails 2021-02-27 17:21:58 +13:00
Ben Hoyt
e492a253ec Ensure value passed to strcmp is non-NULL in unittest.c
Fixes #127. Thanks Seth Arnold.
2021-02-09 15:56:28 +13:00
Ben Hoyt
1e80a47dff
Add INI_CUSTOM_ALLOCATOR to allow using a custom memory allocator (#119)
Fixes https://github.com/benhoyt/inih/issues/118
2020-10-13 21:25:18 +13:00
Anatol Belski
82fdde3fcf Allow handler to be called on a key without '=' or ':' (#87) 2019-10-05 10:27:07 -04:00
Ben Hoyt
1d07c47906 Add TravisCI badge at top of README 2019-04-08 20:58:26 -04:00
Ben Hoyt
29c3b8e88a Test 2019-04-08 20:52:36 -04:00
Ben Hoyt
83e572d6db Test tests 2019-04-08 20:50:20 -04:00
Ben Hoyt
977efc5e73 README tweaks; unittest.c spacing tweaks 2019-04-08 20:42:16 -04:00
ksdhans
be59185856 Add option to call handler when a new section is encountered (#79)
Some programs have ini files with multiple sections that have the same name, which would make it very useful to know when a new section is encountered.

This patch adds this ability as an option that's enabled by setting INI_CALL_HANDLER_ON_NEW_SECTION to 1
2019-04-08 08:44:21 -04:00
Ben Hoyt
d709bdac5b Add support for realloc for very long lines (fixes #61) 2017-12-14 16:01:30 -05:00
Ben Hoyt
56edbbbef9 Add ini_parse_string() function for issue #57, initially suggested in PR #38 2017-05-31 08:52:42 -04:00
Ben Hoyt
30a85920d1 Support for reporting current line
This is @MaG21's PR #56 but solved a different way, using compile-time flags so it's zero-overhead if you don't need it.
2016-12-29 10:53:49 -05:00
Ben Hoyt
18a67c5163 Fix \r\n EOLs in baseline_stop_on_first_error.txt 2016-10-11 09:33:33 -04:00
Ben Hoyt
12758aae01 Delete unittest binaries after use 2016-10-11 09:33:13 -04:00
Ben Hoyt
dbf771afeb Issue #55: handle empty value immediately followed by comment 2016-10-11 09:31:22 -04:00
Ben Hoyt
441b65ba83 Add option to disable inline comments and to specify which inline comment character are allowed: https://github.com/benhoyt/inih/issues/40 2016-01-02 12:43:09 -05:00
Ben Hoyt
e6735fff64 Fix issue noted by @jgroffen where if both : and = were used on a line, = would take precedence ( https://github.com/benhoyt/inih/pull/44) 2016-01-02 11:29:40 -05:00
benhoyt@gmail.com
f2914d460c Add INI_STOP_ON_FIRST_ERROR per Robin Getz (defaults to off).
Add unit test baseline with this option on.
See also f4b25de039
2013-12-19 19:38:21 +00:00
benhoyt@gmail.com
9b0825f08d Fix issue 25: Be sure to call isspace() with unsigned char -- nasty things happen when char type is "signed char" like MSVC's default.
Add unit tests including some non-ASCII UTF-8 chars to repro with MSVC.
2013-01-06 08:40:00 +00:00
benhoyt@gmail.com
23d69228bf Fixed char/unsigned char issue with r20. Added unit test for BOM handling. 2012-06-19 13:48:44 +00:00
benhoyt
0a54de5b78 Fixed issue 16: properly handle comments on multi-line values.
Added batch file to run unit tests.
2012-01-02 20:15:12 +00:00
benhoyt@gmail.com
328c3d4f8a Issue 11: changed Subversion eol-style to native. 2011-06-27 19:44:29 +00:00
benhoyt@gmail.com
b1170c9568 Issue 7: Factored out ini_parse_file() so users can parse INI file with just a FILE* instead of a filename, and use fmemopen.
Forgot to commit examples/test.ini in previous commit.
Fix strncmp redefine warning when compiling tests/unittest.c.
2011-06-24 18:48:58 +00:00
benhoyt
d83f6c327e Added kerrigan29a's patch to allow name:value style lines as per Python's ConfigParser.
Added tests for the above and updated baselines.
2011-03-10 02:58:58 +00:00
benhoyt@gmail.com
d1939f4857 Fix issue 5:
* ';' comments must have ';' preceded by whitespace char
* add '#' comments as per Python's ConfigParser
* added unit tests for the above
2010-09-27 13:56:09 +00:00
benhoyt
4d08274b35 Moved examples to their own examples/ dir.
Only define INI_ALLOW_MULTILINE if it's not already defined.
Added C++ INIReader class.
Moved license into LICENSE.txt, added README.txt.
Added unit tests and checked in baseline files.
Made line lengths < 80 chars.
2009-08-20 21:59:32 +00:00