From a5e4cff32ff66f8e86246faffcdea26e064cb230 Mon Sep 17 00:00:00 2001 From: Chris White Date: Sat, 29 Oct 2022 21:32:21 -0400 Subject: [PATCH] Revert "Remove unsupported tests" This reverts commit 4896ac55f44efe5d65e2bd6bd7f5772576064d6c. https://github.com/editorconfig/specification/pull/31#issuecomment-1272393572 --- parser/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ parser/comments.in | 12 ++++++++++++ 2 files changed, 48 insertions(+) diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt index 89f7544..6a3de76 100644 --- a/parser/CMakeLists.txt +++ b/parser/CMakeLists.txt @@ -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]*$") @@ -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]*$") diff --git a/parser/comments.in b/parser/comments.in index 53abbf0..d3c37cf 100644 --- a/parser/comments.in +++ b/parser/comments.in @@ -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 @@ -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