summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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]])