Skip to content

Commit

Permalink
Revert "Remove unsupported tests"
Browse files Browse the repository at this point in the history
  • Loading branch information
cxw42 committed Oct 30, 2022
1 parent 70840cf commit a5e4cff
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
36 changes: 36 additions & 0 deletions parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,36 @@ 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]*")

# test colon separator with no whitespaces in property assignment
new_ec_test(colon_sep_no_whitespace whitespace.in test1.d "^key=value[ \t\n\r]*$")

# test colon separator with single spaces around equals sign
new_ec_test(colon_sep_single_spaces_around_equals whitespace.in test2.d
"^key=value[ \t\n\r]*$")

# test colon separator with multiple spaces around equals sign
new_ec_test(colon_sep_multiple_spaces_around_equals whitespace.in test3.d
"^key=value[ \t\n\r]*$")

# test colon separator with spaces before property name
new_ec_test(colon_sep_spaces_before_property_name whitespace.in test4.d
"^key=value[ \t\n\r]*$")

# test colon separator with spaces before after property value
new_ec_test(colon_sep_spaces_after_property_value whitespace.in test5.d
"^key=value[ \t\n\r]*$")


# Tests for comment parsing

# test comments ignored after property name
new_ec_test(comments_after_property comments.in test1.c
"^key=value[ \t\n\r]*$")

# test comments ignored after section name
new_ec_test(comments_after_section comments.in test2.c
"^key=value[ \t\n\r]*$")

# test comments ignored before properties
new_ec_test(comment_before_props comments.in test3.c
"^key=value[ \t\n\r]*$")
Expand All @@ -88,6 +116,14 @@ new_ec_test(semicolon_in_property comments.in test5.c
new_ec_test(escaped_semicolon_in_section comments.in "test;.c"
"^key=value[ \t\n\r]*$")

# test octothorpe comments ignored after property name
new_ec_test(octothorpe_comments_after_property comments.in test7.c
"^key=value[ \t\n\r]*$")

# test octothorpe comments ignored after section name
new_ec_test(octothorpe_comments_after_section comments.in test8.c
"^key=value[ \t\n\r]*$")

# test octothorpe comments ignored before properties
new_ec_test(octothorpe_comment_before_props comments.in test9.c
"^key=value[ \t\n\r]*$")
Expand Down
12 changes: 12 additions & 0 deletions parser/comments.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

root = true

[test1.c]
key=value ; Comment after property is ignored

[test2.c] ; Comment ignored, even with ] character
key=value

[test3.c]
; Comment before properties ignored
key=value
Expand All @@ -23,6 +29,12 @@ key=value \; not comment
[test\;.c]
key=value

[test7.c]
key=value # Comment after property is ignored

[test8.c] # Comment ignored, even with ] character
key=value

[test9.c]
# Comment before properties ignored
key=value
Expand Down

0 comments on commit a5e4cff

Please sign in to comment.