Skip to content

Commit

Permalink
Test that long sections are truncated (#180)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
isidroas and benhoyt authored Oct 27, 2024
1 parent 5f8fdf2 commit f93ad93
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/baseline_allow_no_value.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_call_handler_on_new_section.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_disallow_inline_comments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_handler_lineno.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_heap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tests/baseline_heap_max_line.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_heap_realloc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tests/baseline_heap_realloc_max_line.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_multi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tests/baseline_multi_max_line.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_single.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/baseline_stop_on_first_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests/long_section.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# check that section is truncated
[_123456789_123456789_123456789_123456789_123456789_123456789]
name = value
1 change: 1 addition & 0 deletions tests/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ int main(void)
parse("bom.ini");
parse("duplicate_sections.ini");
parse("no_value.ini");
parse("long_section.ini");
return 0;
}

0 comments on commit f93ad93

Please sign in to comment.