From fc87721e99e970adb89d978e53cee7fdeb12f9ce Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Mon, 2 Dec 2019 23:42:56 -0600 Subject: [PATCH] properties -> pairs --- CMakeLists.txt | 12 +++---- filetree/CMakeLists.txt | 2 +- meta/CMakeLists.txt | 2 +- {properties => pairs}/CMakeLists.txt | 12 +++---- {properties => pairs}/indent_size_default.in | 0 pairs/lowercase_names.in | 6 ++++ {properties => pairs}/lowercase_values.in | 4 +-- {properties => pairs}/tab_width_default.in | 0 parser/CMakeLists.txt | 38 ++++++++++---------- parser/comments.in | 8 ++--- parser/whitespace.in | 8 ++--- properties/lowercase_names.in | 6 ---- 12 files changed, 49 insertions(+), 49 deletions(-) rename {properties => pairs}/CMakeLists.txt (90%) rename {properties => pairs}/indent_size_default.in (100%) create mode 100644 pairs/lowercase_names.in rename {properties => pairs}/lowercase_values.in (73%) rename {properties => pairs}/tab_width_default.in (100%) delete mode 100644 properties/lowercase_names.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e744b1e..44624ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,20 +57,20 @@ endif() function(new_ec_test name ec_file src_file regex) add_test(NAME ${name} COMMAND ${EDITORCONFIG_CMD} -f ${ec_file} "${CMAKE_CURRENT_SOURCE_DIR}/${src_file}") - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}") + set_tests_pairs(${name} PAIRS PASS_REGULAR_EXPRESSION "${regex}") endfunction() # A test that requires a version specified function(new_ec_test_version name ec_file src_file regex version) add_test(NAME ${name} COMMAND ${EDITORCONFIG_CMD} -b ${version} -f ${ec_file} "${CMAKE_CURRENT_SOURCE_DIR}/${src_file}") - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}") + set_tests_pairs(${name} PAIRS PASS_REGULAR_EXPRESSION "${regex}") endfunction() # A test that requires the full path to the EditorConfig files function(new_ec_test_full_ec_file_path name ec_file src_file regex) add_test(NAME ${name} COMMAND ${EDITORCONFIG_CMD} -f ${ec_file} ${src_file}) - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}") + set_tests_pairs(${name} PAIRS PASS_REGULAR_EXPRESSION "${regex}") endfunction() # A test that returns multiple lines of output. CAUTION: filenames used in @@ -94,7 +94,7 @@ function(new_ec_test_multiline name ec_file src_file regex) "-P" "${tests_cmakelists_dir}/cmake/ec_sort.cmake") endif() - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION + set_tests_pairs(${name} PAIRS PASS_REGULAR_EXPRESSION "^[\r\n]*${regex}$") # Permit leading \n's because I can't always get rid of them using # only CMake-provided facilities. @@ -111,7 +111,7 @@ function(new_ec_cli_test) # Add test add_test(NAME ${P_NAME} COMMAND ${EDITORCONFIG_CMD} ${P_ARGS}) - set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${P_MATCH}") + set_tests_pairs(${name} PAIRS PASS_REGULAR_EXPRESSION "${P_MATCH}") endfunction() @@ -120,7 +120,7 @@ add_subdirectory(meta) # Then test the core. add_subdirectory(glob) -add_subdirectory(properties) +add_subdirectory(pairs) add_subdirectory(parser) add_subdirectory(filetree) add_subdirectory(cli) diff --git a/filetree/CMakeLists.txt b/filetree/CMakeLists.txt index 1d214ed..5a9e26b 100644 --- a/filetree/CMakeLists.txt +++ b/filetree/CMakeLists.txt @@ -90,7 +90,7 @@ endif() new_ec_test(path_with_special_chars path_with_special_chars.in "path_with_special_[chars/test.a" "^key=value[ \t\n\r]*$") ## " <-- resync the syntax highlighter -# Test the unset value with various common properties +# Test the unset value with various common keys new_ec_test(unset_charset unset.in unset/charset.txt "^charset=unset[ \t\n\r]*$") new_ec_test(unset_end_of_line unset.in unset/end_of_line.txt "^end_of_line=unset[ \t\n\r]*$") new_ec_test_multiline(unset_indent_size_ML unset.in unset/indent_size.txt diff --git a/meta/CMakeLists.txt b/meta/CMakeLists.txt index 4115da1..6dd18f0 100755 --- a/meta/CMakeLists.txt +++ b/meta/CMakeLists.txt @@ -36,7 +36,7 @@ message(STATUS "meta: Using editorconfig ${EDITORCONFIG_CMD}") # Test run_and_sort() add_test(meta_runandsort cmake -P "${tests_meta_cmakelists_dir}/sample.cmake") -set_tests_properties(meta_runandsort PROPERTIES PASS_REGULAR_EXPRESSION +set_tests_pairs(meta_runandsort PAIRS PASS_REGULAR_EXPRESSION "^[\r\n]*0${L}a;b${L}b;c${L}b;e${L}b;f${L}c;b;a${L}d${L}$") # Have to permit leading \n's - I don't know how to get rid of them diff --git a/properties/CMakeLists.txt b/pairs/CMakeLists.txt similarity index 90% rename from properties/CMakeLists.txt rename to pairs/CMakeLists.txt index cbfb86f..dbdc302 100644 --- a/properties/CMakeLists.txt +++ b/pairs/CMakeLists.txt @@ -54,18 +54,18 @@ new_ec_test_multiline(indent_size_default_with_tab_width_ML indent_size_default.in test3.c "indent_size=2[ \t]*[\n\r]+indent_style=tab[ \t]*[\n\r]+tab_width=2[ \t\n\r]*") -# test that same property values are lowercased (v0.9.0 properties) +# test that same pair values are lowercased (v0.9.0 pairs) new_ec_test_multiline(lowercase_values1_ML lowercase_values.in test1.c "end_of_line=crlf[ \t]*[\n\r]+indent_style=space[ \t\n\r]*") -# test that same property values are lowercased (v0.9.0 properties) +# test that same pair values are lowercased (v0.9.0 pairs) new_ec_test_multiline(lowercase_values2_ML lowercase_values.in test2.c "charset=utf-8[ \t]*[\n\r]+insert_final_newline=true[ \t]*[\n\r]+trim_trailing_whitespace=false[ \t\n\r]*$") -# test that same property values are not lowercased +# test that same pair values are not lowercased new_ec_test(lowercase_values3 lowercase_values.in test3.c - "^test_property=TestValue[ \t\n\r]*$") + "^test_key=TestValue[ \t\n\r]*$") -# test that all property names are lowercased +# test that all pair keys are lowercased new_ec_test(lowercase_names lowercase_names.in test.c - "^testproperty=testvalue[ \t\n\r]*$") + "^testkey=testvalue[ \t\n\r]*$") diff --git a/properties/indent_size_default.in b/pairs/indent_size_default.in similarity index 100% rename from properties/indent_size_default.in rename to pairs/indent_size_default.in diff --git a/pairs/lowercase_names.in b/pairs/lowercase_names.in new file mode 100644 index 0000000..e82023c --- /dev/null +++ b/pairs/lowercase_names.in @@ -0,0 +1,6 @@ +; test that pair keys are lowercased + +root = true + +[test.c] +TestKey = testvalue diff --git a/properties/lowercase_values.in b/pairs/lowercase_values.in similarity index 73% rename from properties/lowercase_values.in rename to pairs/lowercase_values.in index 1730bb2..afc0745 100644 --- a/properties/lowercase_values.in +++ b/pairs/lowercase_values.in @@ -1,4 +1,4 @@ -; test property name lowercasing +; test pair key lowercasing root = true @@ -12,4 +12,4 @@ trim_trailing_whitespace = False charset = UTF-8 [test3.c] -test_property = TestValue +test_key = TestValue diff --git a/properties/tab_width_default.in b/pairs/tab_width_default.in similarity index 100% rename from properties/tab_width_default.in rename to pairs/tab_width_default.in diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt index 91f90eb..47f568c 100644 --- a/parser/CMakeLists.txt +++ b/parser/CMakeLists.txt @@ -32,7 +32,7 @@ new_ec_test_multiline(basic_cascade_ML basic.in b.b "option1=c[ \t]*[\n\r]+optio # Tests for whitespace parsing -# test no whitespaces in property assignment +# test no whitespaces in pair assignment new_ec_test(no_whitespace whitespace.in test1.c "^key=value[ \t\n\r]*$") # test single spaces around equals sign @@ -43,16 +43,16 @@ new_ec_test(single_spaces_around_equals whitespace.in test2.c new_ec_test(multiple_spaces_around_equals whitespace.in test3.c "^key=value[ \t\n\r]*$") -# test spaces before property name -new_ec_test(spaces_before_property_name whitespace.in test4.c +# test spaces before pair key +new_ec_test(spaces_before_pair_key whitespace.in test4.c "^key=value[ \t\n\r]*$") -# test spaces before after property value -new_ec_test(spaces_after_property_value whitespace.in test5.c +# test spaces before after pair value +new_ec_test(spaces_after_pair_value whitespace.in test5.c "^key=value[ \t\n\r]*$") -# test blank lines between properties -new_ec_test_multiline(blank_lines_between_properties_ML whitespace.in test6.c +# test blank lines between pairs +new_ec_test_multiline(blank_lines_between_pairs_ML whitespace.in test6.c "key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*") # test spaces in section name @@ -66,37 +66,37 @@ new_ec_test(spaces_before_section_name whitespace.in test8.c # test spaces after section name new_ec_test(spaces_after_section_name whitespace.in test9.c "^key=value[ \t\n\r]*$") -# test spaces at beginning of line between properties -new_ec_test_multiline(spaces_before_middle_property_ML whitespace.in test10.c +# test spaces at beginning of line between pairs +new_ec_test_multiline(spaces_before_middle_pair_ML whitespace.in test10.c "key1=value1[ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+key3=value3[ \t\n\r]*") # Tests for comment parsing -# test comments ignored before properties +# test comments ignored before pairs new_ec_test(comment_before_props comments.in test3.c "^key=value[ \t\n\r]*$") -# test comments ignored between properties +# test comments ignored between pairs new_ec_test_multiline(comment_between_props_ML comments.in test4.c "key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*") -# test semicolons at end of property value are included in value -new_ec_test(semicolon_in_property comments.in test5.c +# test semicolons at end of pair value are included in value +new_ec_test(semicolon_in_pair_value comments.in test5.c "^key=value; not comment[ \t\n\r]*$") # test escaped semicolons are included in section names new_ec_test(escaped_semicolon_in_section comments.in "test;.c" "^key=value[ \t\n\r]*$") -# test octothorpe comments ignored before properties +# test octothorpe comments ignored before pairs new_ec_test(octothorpe_comment_before_props comments.in test9.c "^key=value[ \t\n\r]*$") -# test octothorpe comments ignored between properties +# test octothorpe comments ignored between pairs new_ec_test_multiline(octothorpe_comment_between_props_ML comments.in test10.c "key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*") -# test octothorpe at end of property value are included in value +# test octothorpe at end of pair value are included in value new_ec_test(octothorpe_in_value comments.in test11.c "^key=value# not comment[ \t\n\r]*$") @@ -111,10 +111,10 @@ new_ec_test(bom_at_head bom.in "a.c" "^key=value[ \t\n\r]*$") new_ec_test(crlf_linesep crlf.in "a.c" "^key=value[ \t\n\r]*$") -# Test max property name and values -new_ec_test(max_property_name limits.in test1 +# Test max pair key and values +new_ec_test(max_pair_key limits.in test1 "^00000000000000000000000000000000000000000000000001=50[ \t\n\r]*$") -new_ec_test(max_property_value limits.in test2 +new_ec_test(max_pair_value limits.in test2 "^k255=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001[ \t\n\r]*$") # Test max section names diff --git a/parser/comments.in b/parser/comments.in index 53abbf0..8f6d15c 100644 --- a/parser/comments.in +++ b/parser/comments.in @@ -3,12 +3,12 @@ root = true [test3.c] -; Comment before properties ignored +; Comment before key-value pair ignored key=value [test4.c] key1=value1 -; Comment between properties ignored +; Comment between key-value pairs ignored key2=value2 ; Semicolon at end of value read as part of value @@ -24,12 +24,12 @@ key=value \; not comment key=value [test9.c] -# Comment before properties ignored +# Comment before key-value pair ignored key=value [test10.c] key1=value1 -# Comment between properties ignored +# Comment between key-value pairs ignored key2=value2 # Octothorpe at end of value read as part of value diff --git a/parser/whitespace.in b/parser/whitespace.in index d1f3c5f..84710c0 100644 --- a/parser/whitespace.in +++ b/parser/whitespace.in @@ -14,15 +14,15 @@ key = value [test3.c] key = value -; spaces before property name +; spaces before pair key [test4.c] key=value -; spaces after property value +; spaces after pair value [test5.c] key=value -; blank lines between properties +; blank lines between key-value pairs [test6.c] key1=value1 @@ -41,7 +41,7 @@ key=value [test9.c] key=value -; spacing before middle property +; spacing before middle key-value pair [test10.c] key1=value1 key2=value2 diff --git a/properties/lowercase_names.in b/properties/lowercase_names.in deleted file mode 100644 index 253ea8b..0000000 --- a/properties/lowercase_names.in +++ /dev/null @@ -1,6 +0,0 @@ -; test that property names are lowercased - -root = true - -[test.c] -TestProperty = testvalue