diff --git a/tests/screenshots/tests-test_fold_line.lua---__base b/tests/screenshots/tests-test_fold_line.lua---__base new file mode 100644 index 0000000..50e0c95 --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__base @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|┌fold1", +02|│┌fold2", +03|││┌fold3", +04|│││┌fold4.1", +05|│││└fold4.1", +06|│││┌fold4.2", +07|│││└fold4.2", +08|││└fold3", +09|│└fold2", +10|└fold1", +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/base.txt 3,2 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +02|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +03|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +04|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +05|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +06|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +07|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +08|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +09|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +10|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +11|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +12|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +13|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +14|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +15|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +16|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +17|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +18|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +19|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +20|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +21|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +22|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +23|33333333333333333333333333333333333333333333333333333333333333333333333333333333 +24|11111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/screenshots/tests-test_fold_line.lua---__closed_fold b/tests/screenshots/tests-test_fold_line.lua---__closed_fold new file mode 100644 index 0000000..afa23c6 --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__closed_fold @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|┌fold1", +02|│┌fold2", +03|││┌fold3", +04|││├--- 2 lines: fold4.1",······················································ +05|││├--- 2 lines: fold4.2",······················································ +06|││└fold3", +07|│└fold2", +08|└fold1", +09|~ +10|~ +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/closed_fold.txt 6,2-1 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +02|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +03|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +04|00300000000000000000000000000000000000000000000000000000000000000000000000000000 +05|00300000000000000000000000000000000000000000000000000000000000000000000000000000 +06|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +07|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +08|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +09|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +10|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +11|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +12|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +13|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +14|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +15|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +16|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +17|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +18|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +19|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +20|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +21|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +22|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +23|44444444444444444444444444444444444444444444444444444444444444444444444444444444 +24|11111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/screenshots/tests-test_fold_line.lua---__closed_fold_fallback_current_highlight b/tests/screenshots/tests-test_fold_line.lua---__closed_fold_fallback_current_highlight new file mode 100644 index 0000000..ed5abaf --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__closed_fold_fallback_current_highlight @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|┌fold1", +02|│┌fold2", +03|││┌fold3", +04|││├--- 2 lines: fold4.1",······················································ +05|│││┌fold4.2", +06|│││└fold4.2", +07|││└fold3", +08|│└fold2", +09|└fold1", +10|~ +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/closed_fold_fallback_current_highlight.txt 4,2-1 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +02|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +03|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +04|00300000000000000000000000000000000000000000000000000000000000000000000000000000 +05|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +06|00201111111111111111111111111111111111111111111111111111111111111111111111111111 +07|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +08|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +09|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +10|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +11|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +12|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +13|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +14|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +15|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +16|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +17|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +18|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +19|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +20|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +21|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +22|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +23|44444444444444444444444444444444444444444444444444444444444444444444444444444444 +24|11111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/screenshots/tests-test_fold_line.lua---__current_fold_only b/tests/screenshots/tests-test_fold_line.lua---__current_fold_only new file mode 100644 index 0000000..c4c39b6 --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__current_fold_only @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01| fold1", +02| fold2", +03| fold2", +04| ┌fold2", +05| │ fold5", +06| │ fold5", +07| │ fold5", +08| │ fold5", +09| │ fold5", +10| └ fold5", +11| +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/current_fold_only.txt 4,2 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|00000000000000000000000000000000000000000000000000000000000000000000000000000000 +02|00000000000000000000000000000000000000000000000000000000000000000000000000000000 +03|00000000000000000000000000000000000000000000000000000000000000000000000000000000 +04|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +05|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +06|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +07|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +08|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +09|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +10|00010000000000000000000000000000000000000000000000000000000000000000000000000000 +11|00000000000000000000000000000000000000000000000000000000000000000000000000000000 +12|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +13|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +14|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +15|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +16|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +17|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +18|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +19|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +20|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +21|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +22|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +23|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +24|00000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_end_line b/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_end_line new file mode 100644 index 0000000..501da4c --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_end_line @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|┌┌┌┌┌fold5", +02|│││││fold5", +03|│││││fold5", +04|│││││fold5", +05|│││││fold5", +06|││││└fold5", +07|│││└fold4", +08|││└fold2", +09|│└fold2", +10|└fold1", +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/folds_hava_same_end_line.txt 1,6 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +02|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +03|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +04|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +05|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +06|00001222222222222222222222222222222222222222222222222222222222222222222222222222 +07|00002222222222222222222222222222222222222222222222222222222222222222222222222222 +08|00022222222222222222222222222222222222222222222222222222222222222222222222222222 +09|00222222222222222222222222222222222222222222222222222222222222222222222222222222 +10|02222222222222222222222222222222222222222222222222222222222222222222222222222222 +11|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +12|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +13|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +14|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +15|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +16|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +17|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +18|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +19|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +20|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +21|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +22|11111111111111111111111111111111111111111111111111111111111111111111111111111111 +23|33333333333333333333333333333333333333333333333333333333333333333333333333333333 +24|22222222222222222222222222222222222222222222222222222222222222222222222222222222 diff --git a/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_start_line b/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_start_line new file mode 100644 index 0000000..b87d34d --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__folds_hava_same_start_line @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|││┌fold2", +02|│││┌fold2", +03|││││┌fold5", +04|│││││fold5", +05|│││││fold5", +06|│││││fold5", +07|│││││fold5", +08|└└└└└fold5", +09|~ +10|~ +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/folds_hava_same_start_line.txt 5,1 Bot +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|00011111111111111111111111111111111111111111111111111111111111111111111111111111 +02|00001111111111111111111111111111111111111111111111111111111111111111111111111111 +03|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +04|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +05|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +06|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +07|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +08|00002111111111111111111111111111111111111111111111111111111111111111111111111111 +09|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +10|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +11|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +12|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +13|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +14|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +15|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +16|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +17|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +18|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +19|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +20|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +21|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +22|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +23|33333333333333333333333333333333333333333333333333333333333333333333333333333333 +24|11111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/screenshots/tests-test_fold_line.lua---__use_indent_of_fold_start_line b/tests/screenshots/tests-test_fold_line.lua---__use_indent_of_fold_start_line new file mode 100644 index 0000000..972ce30 --- /dev/null +++ b/tests/screenshots/tests-test_fold_line.lua---__use_indent_of_fold_start_line @@ -0,0 +1,51 @@ +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|┌fold1", +02|│┌fold2", +03|││┌fold3", +04|│││ ┌fold4.1", +05|│││ └fold4.1", +06|│││ ┌fold4.2", +07|│││ └fold4.2", +08|││└fold3", +09|│└fold2", +10|└fold1", +11|~ +12|~ +13|~ +14|~ +15|~ +16|~ +17|~ +18|~ +19|~ +20|~ +21|~ +22|~ +23|tests/testcases/use_indent_of_fold_start_line.txt 3,2 All +24| + +--|---------|---------|---------|---------|---------|---------|---------|---------| +01|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +02|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +03|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +04|00211111111011111111111111111111111111111111111111111111111111111111111111111111 +05|00211111111011111111111111111111111111111111111111111111111111111111111111111111 +06|00211011111111111111111111111111111111111111111111111111111111111111111111111111 +07|00211011111111111111111111111111111111111111111111111111111111111111111111111111 +08|00211111111111111111111111111111111111111111111111111111111111111111111111111111 +09|00111111111111111111111111111111111111111111111111111111111111111111111111111111 +10|01111111111111111111111111111111111111111111111111111111111111111111111111111111 +11|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +12|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +13|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +14|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +15|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +16|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +17|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +18|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +19|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +20|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +21|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +22|22222222222222222222222222222222222222222222222222222222222222222222222222222222 +23|33333333333333333333333333333333333333333333333333333333333333333333333333333333 +24|11111111111111111111111111111111111111111111111111111111111111111111111111111111 diff --git a/tests/test_fold_line.lua b/tests/test_fold_line.lua index 0ca7265..535eecc 100644 --- a/tests/test_fold_line.lua +++ b/tests/test_fold_line.lua @@ -23,6 +23,26 @@ local T = new_set({ }, }) +---@type string[] +local testfiles = vim.fs.find(function(name, _) + return name:match(".*txt$") +end, { + path = "tests/testcases", + limit = math.huge, + type = "file", +}) + +for _, testfile in ipairs(testfiles) do + local name = vim.fn.fnamemodify(testfile, ":t:r") + local fold_cmd_file = testfile:match("(.*).txt") .. ".vim" + + T["__" .. name] = function(buf_id, lines) + child.cmd("e " .. testfile) + child.cmd("source " .. fold_cmd_file) + expect.reference_screenshot(child.get_screenshot()) + end +end + local set_lines = function(lines) child.api.nvim_buf_set_lines(0, 0, -1, true, lines) end @@ -32,149 +52,6 @@ local make_fold = function(start_line, end_line) child.cmd("normal " .. tostring(end_line - start_line + 1) .. "zFzo") end -T["basic"] = function(buf_id, lines) - set_lines({ - " fold1", - " fold2", - " fold3", - " fold4.1", - " fold4.1", - " fold4.2", - " fold4.2", - " fold3", - " fold2", - " fold1", - }) - make_fold(1, 10) - make_fold(2, 9) - make_fold(3, 8) - make_fold(4, 5) - make_fold(6, 7) - - expect.reference_screenshot(child.get_screenshot()) -end - -T["same fold start line"] = function(buf_id, lines) - set_lines({ - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - " fold4", - " fold2", - " fold2", - " fold1", - }) - make_fold(1, 10) - make_fold(1, 9) - make_fold(1, 8) - make_fold(1, 7) - make_fold(1, 6) - - expect.reference_screenshot(child.get_screenshot()) -end - -T["same fold end line"] = function(buf_id, lines) - set_lines({ - " fold1", - " fold2", - " fold2", - " fold2", - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - }) - make_fold(1, 10) - make_fold(2, 10) - make_fold(3, 10) - make_fold(4, 10) - make_fold(5, 10) - - expect.reference_screenshot(child.get_screenshot()) -end - -T["current fold only"] = function(buf_id, lines) - child.lua("vim.g.fold_line_current_fold_only = true") - - set_lines({ - " fold1", - " fold2", - " fold2", - " fold2", - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - " fold5", - }) - make_fold(1, 10) - make_fold(2, 10) - make_fold(3, 10) - make_fold(4, 10) - make_fold(5, 10) - - child.cmd("5") - - expect.reference_screenshot(child.get_screenshot()) -end - -T["fallback current closed fold"] = function(buf_id, lines) - child.lua("vim.g.fold_line_current_fold_only = true") - - set_lines({ - " fold1", - " fold2", - " fold3", - " fold4.1", - " fold4.1", - " fold4.2", - " fold4.2", - " fold3", - " fold2", - " fold1", - }) - make_fold(1, 10) - make_fold(2, 9) - make_fold(3, 8) - make_fold(4, 5) - make_fold(6, 7) - - child.cmd("4 | foldclose") - - expect.reference_screenshot(child.get_screenshot()) -end - -T["closed fold"] = function(buf_id, lines) - set_lines({ - " fold1", - " fold2", - " fold3", - " fold4.1", - " fold4.1", - " fold4.2", - " fold4.2", - " fold3", - " fold2", - " fold1", - }) - make_fold(1, 10) - make_fold(2, 9) - make_fold(3, 8) - make_fold(4, 5) - make_fold(6, 7) - - child.cmd("4 | foldclose") - child.cmd("6 | foldclose") - - expect.reference_screenshot(child.get_screenshot()) -end - T["larger level on fold4.2 start line"] = function(buf_id, lines) set_lines({ " fold1", @@ -226,28 +103,6 @@ T["larger level below fold4.1 end line"] = function(buf_id, lines) expect.reference_screenshot(child.get_screenshot()) end -T["use indent of fold start line"] = function(buf_id, lines) - set_lines({ - " fold1", - " fold2", - " fold3", - " fold4.1", - " fold4.1", - " fold4.2", - " fold4.2", - " fold3", - " fold2", - " fold1", - }) - make_fold(1, 10) - make_fold(2, 9) - make_fold(3, 8) - make_fold(4, 5) - make_fold(6, 7) - - expect.reference_screenshot(child.get_screenshot()) -end - T["start line of a fold is a closed sub fold"] = function(buf_id, lines) set_lines({ " fold1", diff --git a/tests/testcases/base.txt b/tests/testcases/base.txt new file mode 100644 index 0000000..7bf254d --- /dev/null +++ b/tests/testcases/base.txt @@ -0,0 +1,10 @@ + fold1", + fold2", + fold3", + fold4.1", + fold4.1", + fold4.2", + fold4.2", + fold3", + fold2", + fold1", diff --git a/tests/testcases/base.vim b/tests/testcases/base.vim new file mode 100644 index 0000000..3dc5e75 --- /dev/null +++ b/tests/testcases/base.vim @@ -0,0 +1,22 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +4,5fold +6,7fold +3,8fold +2,9fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +" vim: set ft=vim : diff --git a/tests/testcases/closed_fold.txt b/tests/testcases/closed_fold.txt new file mode 100644 index 0000000..7bf254d --- /dev/null +++ b/tests/testcases/closed_fold.txt @@ -0,0 +1,10 @@ + fold1", + fold2", + fold3", + fold4.1", + fold4.1", + fold4.2", + fold4.2", + fold3", + fold2", + fold1", diff --git a/tests/testcases/closed_fold.vim b/tests/testcases/closed_fold.vim new file mode 100644 index 0000000..f36d3e2 --- /dev/null +++ b/tests/testcases/closed_fold.vim @@ -0,0 +1,26 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +4,5fold +6,7fold +3,8fold +2,9fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +4 +normal! zc +6 +normal! zc +" vim: set ft=vim : diff --git a/tests/testcases/closed_fold_fallback_current_highlight.txt b/tests/testcases/closed_fold_fallback_current_highlight.txt new file mode 100644 index 0000000..7bf254d --- /dev/null +++ b/tests/testcases/closed_fold_fallback_current_highlight.txt @@ -0,0 +1,10 @@ + fold1", + fold2", + fold3", + fold4.1", + fold4.1", + fold4.2", + fold4.2", + fold3", + fold2", + fold1", diff --git a/tests/testcases/closed_fold_fallback_current_highlight.vim b/tests/testcases/closed_fold_fallback_current_highlight.vim new file mode 100644 index 0000000..d0fcb23 --- /dev/null +++ b/tests/testcases/closed_fold_fallback_current_highlight.vim @@ -0,0 +1,24 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +4,5fold +6,7fold +3,8fold +2,9fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +4 +normal! zc +" vim: set ft=vim : diff --git a/tests/testcases/current_fold_only.txt b/tests/testcases/current_fold_only.txt new file mode 100644 index 0000000..2252d00 --- /dev/null +++ b/tests/testcases/current_fold_only.txt @@ -0,0 +1,11 @@ + fold1", + fold2", + fold2", + fold2", + fold5", + fold5", + fold5", + fold5", + fold5", + fold5", + diff --git a/tests/testcases/current_fold_only.vim b/tests/testcases/current_fold_only.vim new file mode 100644 index 0000000..7a5b39c --- /dev/null +++ b/tests/testcases/current_fold_only.vim @@ -0,0 +1,26 @@ +let g:fold_line_current_fold_only=v:true + +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +5,10fold +4,10fold +3,10fold +2,10fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +4 +normal! zo +" vim: set ft=vim : diff --git a/tests/testcases/folds_hava_same_end_line.txt b/tests/testcases/folds_hava_same_end_line.txt new file mode 100644 index 0000000..9f3034c --- /dev/null +++ b/tests/testcases/folds_hava_same_end_line.txt @@ -0,0 +1,10 @@ + fold5", + fold5", + fold5", + fold5", + fold5", + fold5", + fold4", + fold2", + fold2", + fold1", diff --git a/tests/testcases/folds_hava_same_end_line.vim b/tests/testcases/folds_hava_same_end_line.vim new file mode 100644 index 0000000..58f6169 --- /dev/null +++ b/tests/testcases/folds_hava_same_end_line.vim @@ -0,0 +1,24 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +1,6fold +1,7fold +1,8fold +1,9fold +1,10fold +let &fdl = &fdl +1 +normal! zo +1 +normal! zo +1 +normal! zo +1 +normal! zo +" vim: set ft=vim : diff --git a/tests/testcases/folds_hava_same_start_line.txt b/tests/testcases/folds_hava_same_start_line.txt new file mode 100644 index 0000000..2663f43 --- /dev/null +++ b/tests/testcases/folds_hava_same_start_line.txt @@ -0,0 +1,10 @@ + fold1", + fold2", + fold2", + fold2", + fold5", + fold5", + fold5", + fold5", + fold5", + fold5", diff --git a/tests/testcases/folds_hava_same_start_line.vim b/tests/testcases/folds_hava_same_start_line.vim new file mode 100644 index 0000000..e6497a2 --- /dev/null +++ b/tests/testcases/folds_hava_same_start_line.vim @@ -0,0 +1,30 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +5,10fold +4,10fold +3,10fold +2,10fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +4 +normal! zo +let s:l = 5 - ((4 * winheight(0) + 23) / 47) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 5 +normal! 0 +" vim: set ft=vim : diff --git a/tests/testcases/use_indent_of_fold_start_line.txt b/tests/testcases/use_indent_of_fold_start_line.txt new file mode 100644 index 0000000..89106a5 --- /dev/null +++ b/tests/testcases/use_indent_of_fold_start_line.txt @@ -0,0 +1,10 @@ + fold1", + fold2", + fold3", + fold4.1", + fold4.1", + fold4.2", + fold4.2", + fold3", + fold2", + fold1", diff --git a/tests/testcases/use_indent_of_fold_start_line.vim b/tests/testcases/use_indent_of_fold_start_line.vim new file mode 100644 index 0000000..3dc5e75 --- /dev/null +++ b/tests/testcases/use_indent_of_fold_start_line.vim @@ -0,0 +1,22 @@ +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=99 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +4,5fold +6,7fold +3,8fold +2,9fold +1,10fold +let &fdl = &fdl +1 +normal! zo +2 +normal! zo +3 +normal! zo +" vim: set ft=vim :