aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/lua
diff options
context:
space:
mode:
authorJędrzej Boczar <yendreij@gmail.com>2021-04-22 20:53:30 +0200
committerKiyan <yazdani.kiyan@protonmail.com>2021-04-23 21:21:38 +0200
commit63a88c873f3643aad9208488765dc53618edd40e (patch)
treefb233a54b0dae8a6af1a12dfecb9cd85cbdb4f64 /tests/indent/lua
parentignore Lua indent test files when doing style-check (diff)
downloadnvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar.gz
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar.bz2
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar.lz
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar.xz
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.tar.zst
nvim-treesitter-63a88c873f3643aad9208488765dc53618edd40e.zip
move all tests to top-level tests/ directory
Diffstat (limited to 'tests/indent/lua')
-rw-r--r--tests/indent/lua/comment.lua7
-rw-r--r--tests/indent/lua/cond.lua12
-rw-r--r--tests/indent/lua/func.lua9
-rw-r--r--tests/indent/lua/loop.lua14
-rw-r--r--tests/indent/lua/string.lua5
-rw-r--r--tests/indent/lua/table.lua10
6 files changed, 57 insertions, 0 deletions
diff --git a/tests/indent/lua/comment.lua b/tests/indent/lua/comment.lua
new file mode 100644
index 000000000..9f3624e1e
--- /dev/null
+++ b/tests/indent/lua/comment.lua
@@ -0,0 +1,7 @@
+-- some
+-- comment
+
+--[[
+ another
+ comment
+--]]
diff --git a/tests/indent/lua/cond.lua b/tests/indent/lua/cond.lua
new file mode 100644
index 000000000..dfae37f05
--- /dev/null
+++ b/tests/indent/lua/cond.lua
@@ -0,0 +1,12 @@
+local x = 10
+
+if x > 3 then
+ x = 3
+elseif x < 3 then
+ x = -3
+else
+ if x > 0 then
+ x = 1
+ end
+ x = 0
+end
diff --git a/tests/indent/lua/func.lua b/tests/indent/lua/func.lua
new file mode 100644
index 000000000..1f95ca97a
--- /dev/null
+++ b/tests/indent/lua/func.lua
@@ -0,0 +1,9 @@
+function foo(x)
+ local bar = function(a, b, c)
+ return a + b + c
+ end
+ return bar(
+ x,
+ 1,
+ 2)
+end
diff --git a/tests/indent/lua/loop.lua b/tests/indent/lua/loop.lua
new file mode 100644
index 000000000..7f5402d1e
--- /dev/null
+++ b/tests/indent/lua/loop.lua
@@ -0,0 +1,14 @@
+local x = 1
+
+while x < 10 do
+ x = x + 1
+ break
+end
+
+for i = 1,3 do
+ x = x + i
+end
+
+repeat
+ x = x + 1
+until x > 100
diff --git a/tests/indent/lua/string.lua b/tests/indent/lua/string.lua
new file mode 100644
index 000000000..adfebf76a
--- /dev/null
+++ b/tests/indent/lua/string.lua
@@ -0,0 +1,5 @@
+local s = [[
+a
+ multiline
+ string
+]]
diff --git a/tests/indent/lua/table.lua b/tests/indent/lua/table.lua
new file mode 100644
index 000000000..d53504b45
--- /dev/null
+++ b/tests/indent/lua/table.lua
@@ -0,0 +1,10 @@
+local a = {
+ x = 1,
+ y = 2,
+ z = {
+ 1, 2, 3,
+ },
+ ['hello world'] = {
+ 1, 2, 3
+ }
+}