From cb8ead4adba160d94866c00584840e6747927653 Mon Sep 17 00:00:00 2001 From: Isidro Arias Date: Fri, 25 Oct 2024 13:13:41 +0200 Subject: [PATCH 1/4] test that long sections are truncated at MAX_SECTION=50 --- tests/long_section.ini | 3 +++ tests/unittest.c | 1 + 2 files changed, 4 insertions(+) create mode 100644 tests/long_section.ini diff --git a/tests/long_section.ini b/tests/long_section.ini new file mode 100644 index 0000000..ca6d63e --- /dev/null +++ b/tests/long_section.ini @@ -0,0 +1,3 @@ +# check that section is truncated +[_123456789_123456789_123456789_123456789_123456789_123456789] +name = value diff --git a/tests/unittest.c b/tests/unittest.c index fde8e61..8ac6e27 100644 --- a/tests/unittest.c +++ b/tests/unittest.c @@ -72,5 +72,6 @@ int main(void) parse("bom.ini"); parse("duplicate_sections.ini"); parse("no_value.ini"); + parse("long_section.ini"); return 0; } From 8ed630c07daeb2cf61accdc365a08080b5956492 Mon Sep 17 00:00:00 2001 From: Isidro Arias Date: Fri, 25 Oct 2024 17:02:03 +0200 Subject: [PATCH 2/4] generated .txt executing unittest.sh --- tests/baseline_allow_no_value.txt | 3 +++ tests/baseline_call_handler_on_new_section.txt | 3 +++ tests/baseline_disallow_inline_comments.txt | 3 +++ tests/baseline_handler_lineno.txt | 3 +++ tests/baseline_heap.txt | 3 +++ tests/baseline_heap_max_line.txt | 2 ++ tests/baseline_heap_realloc.txt | 3 +++ tests/baseline_heap_realloc_max_line.txt | 2 ++ tests/baseline_multi.txt | 3 +++ tests/baseline_multi_max_line.txt | 2 ++ tests/baseline_single.txt | 3 +++ tests/baseline_stop_on_first_error.txt | 3 +++ 12 files changed, 33 insertions(+) diff --git a/tests/baseline_allow_no_value.txt b/tests/baseline_allow_no_value.txt index c26aa93..f84771d 100644 --- a/tests/baseline_allow_no_value.txt +++ b/tests/baseline_allow_no_value.txt @@ -69,3 +69,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=0 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_call_handler_on_new_section.txt b/tests/baseline_call_handler_on_new_section.txt index d8c639b..133737b 100644 --- a/tests/baseline_call_handler_on_new_section.txt +++ b/tests/baseline_call_handler_on_new_section.txt @@ -67,3 +67,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_disallow_inline_comments.txt b/tests/baseline_disallow_inline_comments.txt index bb63721..df1dc3f 100644 --- a/tests/baseline_disallow_inline_comments.txt +++ b/tests/baseline_disallow_inline_comments.txt @@ -65,3 +65,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_handler_lineno.txt b/tests/baseline_handler_lineno.txt index 40a3934..5903d79 100644 --- a/tests/baseline_handler_lineno.txt +++ b/tests/baseline_handler_lineno.txt @@ -64,3 +64,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; line 9 no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; line 3 +long_section.ini: e=0 user=110 diff --git a/tests/baseline_heap.txt b/tests/baseline_heap.txt index 04ec0ae..76f205a 100644 --- a/tests/baseline_heap.txt +++ b/tests/baseline_heap.txt @@ -64,3 +64,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_heap_max_line.txt b/tests/baseline_heap_max_line.txt index 24ee5af..265c8a6 100644 --- a/tests/baseline_heap_max_line.txt +++ b/tests/baseline_heap_max_line.txt @@ -68,3 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... name=value; +long_section.ini: e=2 user=110 diff --git a/tests/baseline_heap_realloc.txt b/tests/baseline_heap_realloc.txt index 04ec0ae..76f205a 100644 --- a/tests/baseline_heap_realloc.txt +++ b/tests/baseline_heap_realloc.txt @@ -64,3 +64,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_heap_realloc_max_line.txt b/tests/baseline_heap_realloc_max_line.txt index 24ee5af..265c8a6 100644 --- a/tests/baseline_heap_realloc_max_line.txt +++ b/tests/baseline_heap_realloc_max_line.txt @@ -68,3 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... name=value; +long_section.ini: e=2 user=110 diff --git a/tests/baseline_multi.txt b/tests/baseline_multi.txt index 04ec0ae..76f205a 100644 --- a/tests/baseline_multi.txt +++ b/tests/baseline_multi.txt @@ -64,3 +64,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_multi_max_line.txt b/tests/baseline_multi_max_line.txt index 24ee5af..265c8a6 100644 --- a/tests/baseline_multi_max_line.txt +++ b/tests/baseline_multi_max_line.txt @@ -68,3 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... name=value; +long_section.ini: e=2 user=110 diff --git a/tests/baseline_single.txt b/tests/baseline_single.txt index 8123f95..d8e3e37 100644 --- a/tests/baseline_single.txt +++ b/tests/baseline_single.txt @@ -59,3 +59,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 diff --git a/tests/baseline_stop_on_first_error.txt b/tests/baseline_stop_on_first_error.txt index aa91014..ecefd2b 100644 --- a/tests/baseline_stop_on_first_error.txt +++ b/tests/baseline_stop_on_first_error.txt @@ -58,3 +58,6 @@ bom.ini: e=0 user=107 ... single2=qrs; duplicate_sections.ini: e=0 user=108 no_value.ini: e=2 user=108 +... [_123456789_123456789_123456789_123456789_12345678] +... name=value; +long_section.ini: e=0 user=110 From 9f0a1d2199b1a9f0a20003d848918a881a2d91e4 Mon Sep 17 00:00:00 2001 From: Isidro Arias Date: Fri, 25 Oct 2024 17:05:20 +0200 Subject: [PATCH 3/4] expected result --- tests/baseline_heap_max_line.txt | 1 + tests/baseline_heap_realloc_max_line.txt | 1 + tests/baseline_multi_max_line.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/baseline_heap_max_line.txt b/tests/baseline_heap_max_line.txt index 265c8a6..a44eaa8 100644 --- a/tests/baseline_heap_max_line.txt +++ b/tests/baseline_heap_max_line.txt @@ -68,5 +68,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110 diff --git a/tests/baseline_heap_realloc_max_line.txt b/tests/baseline_heap_realloc_max_line.txt index 265c8a6..a44eaa8 100644 --- a/tests/baseline_heap_realloc_max_line.txt +++ b/tests/baseline_heap_realloc_max_line.txt @@ -68,5 +68,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110 diff --git a/tests/baseline_multi_max_line.txt b/tests/baseline_multi_max_line.txt index 265c8a6..a44eaa8 100644 --- a/tests/baseline_multi_max_line.txt +++ b/tests/baseline_multi_max_line.txt @@ -68,5 +68,6 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 +... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110 From 1281da8436da376d6cd919a6d79b8bcde424dd9d Mon Sep 17 00:00:00 2001 From: Ben Hoyt Date: Sun, 27 Oct 2024 09:50:52 +0100 Subject: [PATCH 4/4] Sections will be ignores when len(section) > len(INI_MAX_LINE) --- tests/baseline_heap_max_line.txt | 1 - tests/baseline_heap_realloc_max_line.txt | 1 - tests/baseline_multi_max_line.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/tests/baseline_heap_max_line.txt b/tests/baseline_heap_max_line.txt index a44eaa8..265c8a6 100644 --- a/tests/baseline_heap_max_line.txt +++ b/tests/baseline_heap_max_line.txt @@ -68,6 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 -... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110 diff --git a/tests/baseline_heap_realloc_max_line.txt b/tests/baseline_heap_realloc_max_line.txt index a44eaa8..265c8a6 100644 --- a/tests/baseline_heap_realloc_max_line.txt +++ b/tests/baseline_heap_realloc_max_line.txt @@ -68,6 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 -... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110 diff --git a/tests/baseline_multi_max_line.txt b/tests/baseline_multi_max_line.txt index a44eaa8..265c8a6 100644 --- a/tests/baseline_multi_max_line.txt +++ b/tests/baseline_multi_max_line.txt @@ -68,6 +68,5 @@ duplicate_sections.ini: e=0 user=108 ... [section1] ... key1=val1; no_value.ini: e=2 user=109 -... [_123456789_123456789_123456789_123456789_12345678] ... name=value; long_section.ini: e=2 user=110