Skip to content

Commit

Permalink
Test keys set to empty strings (#52)
Browse files Browse the repository at this point in the history
* Test keys set to empty strings
editorconfig/editorconfig#496
  • Loading branch information
ppalaga authored Sep 22, 2024
1 parent 69c8616 commit e196495
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ new_ec_test(spaces_after_section_name whitespace.in test9.c "^key=value[ \t\n\r]
new_ec_test_multiline(spaces_before_middle_property_ML whitespace.in test10.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+key3=value3[ \t\n\r]*")

# value with whitespace inside and the leading and trailing ws ignored
new_ec_test(value_with_whitespace_inside whitespace.in test11.c
"^key=value with whitespace inside[\n\r]+$")

# Tests for comment parsing

# test comments ignored before properties
Expand Down Expand Up @@ -129,3 +133,6 @@ new_ec_test(empty_editorconfig_file empty.in test4 "^[ \t\n\r]*$")
new_ec_test(newlines_only_editorconfig_file newlines_only.in test4 "^[ \t\n\r]*$")
new_ec_test(comments_only_editorconfig_file comments_only.in test4 "^[ \t\n\r]*$")
new_ec_test(comments_and_newlines_editorconfig_file comments_and_newlines.in test4 "^[ \t\n\r]*$")

# A value set to empty string
new_ec_test(key_set_to_empty_string empty_values.in test1 "^key1=[\n\r]+key2=[\n\r]+key3=[\n\r]+$")
9 changes: 9 additions & 0 deletions parser/empty_values.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[test1]
; A value set to empty string
key1=
; Whitespace after equals sign is ignored
key2=
; A file final key set to empty string
key3=
4 changes: 4 additions & 0 deletions parser/whitespace.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ key=value
key1=value1
key2=value2
key3=value3

; value with whitespace inside and the leading and trailing ws ignored
[test11.c]
key= value with whitespace inside

0 comments on commit e196495

Please sign in to comment.