summaryrefslogtreecommitdiff
path: root/test/basic
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-01 16:12:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-01 16:12:49 +0800
commitda4ddec0289d7d72ce53816259cbfb0069353ab1 (patch)
tree1ac6033fbdb094acfdf0ecef8f0166615e186501 /test/basic
parentbf8a629270d9e259f0149fa9d4af08d6135eaff5 (diff)
downloadlua-language-server-da4ddec0289d7d72ce53816259cbfb0069353ab1.zip
#398 fix didChange at eof
Diffstat (limited to 'test/basic')
-rw-r--r--test/basic/init.lua116
1 files changed, 116 insertions, 0 deletions
diff --git a/test/basic/init.lua b/test/basic/init.lua
new file mode 100644
index 00000000..3c6d591f
--- /dev/null
+++ b/test/basic/init.lua
@@ -0,0 +1,116 @@
+local files = require 'files'
+
+local text = [[
+
+
+function Test(self)
+
+end
+]]
+files.setText('', text)
+
+local changes = {
+ [1] = {
+ range = {
+ ["end"] = {
+ character = 0,
+ line = 5,
+ },
+ start = {
+ character = 0,
+ line = 5,
+ },
+ },
+ rangeLength = 0,
+ text = "\
+",
+ },
+ [2] = {
+ range = {
+ ["end"] = {
+ character = 0,
+ line = 6,
+ },
+ start = {
+ character = 0,
+ line = 6,
+ },
+ },
+ rangeLength = 0,
+ text = "a",
+ },
+ [3] = {
+ range = {
+ ["end"] = {
+ character = 1,
+ line = 6,
+ },
+ start = {
+ character = 1,
+ line = 6,
+ },
+ },
+ rangeLength = 0,
+ text = "s",
+ },
+ [4] = {
+ range = {
+ ["end"] = {
+ character = 2,
+ line = 6,
+ },
+ start = {
+ character = 2,
+ line = 6,
+ },
+ },
+ rangeLength = 0,
+ text = "s",
+ },
+ [5] = {
+ range = {
+ ["end"] = {
+ character = 3,
+ line = 6,
+ },
+ start = {
+ character = 3,
+ line = 6,
+ },
+ },
+ rangeLength = 0,
+ text = "e",
+ },
+ [6] = {
+ range = {
+ ["end"] = {
+ character = 4,
+ line = 6,
+ },
+ start = {
+ character = 4,
+ line = 6,
+ },
+ },
+ rangeLength = 0,
+ text = "r",
+ },
+}
+
+for _, change in ipairs(changes) do
+ if change.range then
+ local start, finish = files.unrange('', change.range)
+ text = text:sub(1, start - 1) .. change.text .. text:sub(finish)
+ else
+ text = change.text
+ end
+end
+
+assert(text == [[
+
+
+function Test(self)
+
+end
+
+asser]])