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/runtest.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/runtest.lua')
-rw-r--r-- | plugins/editorconfig/runtest.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/plugins/editorconfig/runtest.lua b/plugins/editorconfig/runtest.lua new file mode 100644 index 0000000..85378cd --- /dev/null +++ b/plugins/editorconfig/runtest.lua @@ -0,0 +1,63 @@ +local core = require "core" +local tests = require "plugins.editorconfig.tests" + +-- disable print buffer for immediate output +io.stdout:setvbuf "no" + +-- overwrite to print into stdout +function core.error(format, ...) + print(string.format(format, ...)) +end + +function core.log(format, ...) + print(string.format(format, ...)) +end + +function core.log_quiet(format, ...) + print(string.format(format, ...)) +end + +-- check if --parsers flag was given to only output the path expressions and +-- their conversion into regular expressions. +local PARSERS = false +for _, argument in ipairs(ARGS) do + if argument == "--parsers" then + PARSERS = true + end +end + +if not PARSERS then + require "plugins.editorconfig.tests.glob" + require "plugins.editorconfig.tests.parser" + require "plugins.editorconfig.tests.properties" + + tests.run() +else + -- Globs + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/braces.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/brackets.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/question.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/star.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/star_star.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/glob/utf8char.in") + + -- Parser + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/basic.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/bom.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/comments.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/comments_and_newlines.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/comments_only.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/crlf.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/empty.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/limits.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/newlines_only.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/parser/whitespace.in") + + -- Properties + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/properties/indent_size_default.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/properties/lowercase_names.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/properties/lowercase_values.in") + tests.add_parser(USERDIR .. "/plugins/editorconfig/tests/properties/tab_width_default.in") + + tests.run_parsers() +end |