diff options
author | Jefferson González <jgmdev@gmail.com> | 2022-12-24 23:06:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 23:06:24 -0400 |
commit | 363c3eb859ddbe1efad5949ad087c8e7db6cee41 (patch) | |
tree | df6ae14c1b360d710ce0d4b5c11950e91a2d0517 /plugins/editorconfig/tests/properties/init.lua | |
parent | 7bb53600a33c2f630f2a0850a543c356a856f172 (diff) | |
download | lite-xl-plugins-363c3eb859ddbe1efad5949ad087c8e7db6cee41.tar.gz lite-xl-plugins-363c3eb859ddbe1efad5949ad087c8e7db6cee41.zip |
added editorconfig plugin (#163)
* properly ignore comments on declarations
* strip newlines when insert_final_newline set to false
* force match up to the end
* support unset property
* make property values case insensitive
* handle indent_size when set to tab
* handle escaped comment chars
* also lowercase property names
* support utf-8 as on spec
* apply rules to unsaved unamed/named docs
* annotation fix
* added test suite and fixes for 100% pass rate
* do not force match from start, breaks 2 tests
* allow starting wild cards to match everything
* disabled print buffering
* make last line visible if insert_final_newline true
* use log_quiet for debug
* adapted to changes on lite-xl/lite-xl#1232
* properly return from add/remove_project_directory overrides
* Use new trimwhitespace functionality if possible
Diffstat (limited to 'plugins/editorconfig/tests/properties/init.lua')
-rw-r--r-- | plugins/editorconfig/tests/properties/init.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/editorconfig/tests/properties/init.lua b/plugins/editorconfig/tests/properties/init.lua new file mode 100644 index 0000000..4ae22d0 --- /dev/null +++ b/plugins/editorconfig/tests/properties/init.lua @@ -0,0 +1,42 @@ +local tests = require "plugins.editorconfig.tests" + +-- test tab_width default +tests.add("tab_width_default_ML", "properties/tab_width_default.in", "test.c", + "indent_size=4[ \t]*[\n\r]+indent_style=space[ \t]*[\n\r]+tab_width=4[\t\n\r]*") + +-- Tab_width should not be set to any value if indent_size is "tab" and +-- tab_width is not set +tests.add("tab_width_default_indent_size_tab_ML", "properties/tab_width_default.in", + "test2.c", "indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*") + +-- Test indent_size default. When indent_style is "tab", indent_size defaults to +-- "tab". +tests.add("indent_size_default_ML", "properties/indent_size_default.in", "test.c", + "indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*") + +-- Test indent_size default. When indent_style is "space", indent_size has no +-- default value. +tests.add("indent_size_default_space", "properties/indent_size_default.in", "test2.c", + "^indent_style=space[ \t\n\r]*$") + +-- Test indent_size default. When indent_style is "tab" and tab_width is set, +-- indent_size should default to tab_width +tests.add("indent_size_default_with_tab_width_ML", + "properties/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) +tests.add("lowercase_values1_ML", "properties/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) +tests.add("lowercase_values2_ML", "properties/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 +tests.add("lowercase_values3", "properties/lowercase_values.in", "test3.c", + "^test_property=TestValue[ \t\n\r]*$") + +-- test that all property names are lowercased +tests.add("lowercase_names", "properties/lowercase_names.in", "test.c", + "^testproperty=testvalue[ \t\n\r]*$") |