spacevim/bundle/nvim-treesitter-0.9.1/tests/indent/tiger_spec.lua
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

114 lines
5.9 KiB
Lua

local Runner = require("tests.indent.common").Runner
local runner = Runner:new(it, "tests/indent/tiger", {
tabstop = 2,
shiftwidth = 2,
softtabstop = 0,
expandtab = true,
})
describe("indent Tiger:", function()
describe("whole file:", function()
runner:whole_file "."
end)
describe("new line:", function()
runner:new_line("classes.tig", { on_line = 1, text = "var a := 0", indent = 2 }, "class declaration beginning")
runner:new_line("classes.tig", { on_line = 2, text = "var a := 0", indent = 2 }, "class declaration after field")
runner:new_line("classes.tig", { on_line = 4, text = "var a := 0", indent = 2 }, "class declaration after method")
runner:new_line("classes.tig", { on_line = 5, text = "var a := 0", indent = 0 }, "after class declaration")
runner:new_line("classes.tig", { on_line = 7, text = "var a := 0", indent = 2 }, "class type beginning")
runner:new_line("classes.tig", { on_line = 8, text = "var a := 0", indent = 2 }, "class type after field")
runner:new_line("classes.tig", { on_line = 10, text = "self.a := 0", indent = 4 }, "inside method")
runner:new_line("classes.tig", { on_line = 13, text = "var a := 0", indent = 2 }, "class type after method")
runner:new_line("classes.tig", { on_line = 14, text = "var a := 0", indent = 0 }, "after class type")
runner:new_line("control-flow.tig", { on_line = 2, text = "true", indent = 4 }, "if condition")
runner:new_line("control-flow.tig", { on_line = 4, text = "true", indent = 4 }, "if consequence")
runner:new_line("control-flow.tig", { on_line = 4, text = "true", indent = 4 }, "if alternative")
runner:new_line("control-flow.tig", { on_line = 10, text = "start := 0", indent = 4 }, "for index start")
runner:new_line("control-flow.tig", { on_line = 12, text = "the_end", indent = 4 }, "for index end")
runner:new_line("control-flow.tig", { on_line = 14, text = "break", indent = 4 }, "for body")
runner:new_line("control-flow.tig", { on_line = 18, text = "true", indent = 4 }, "while condition")
runner:new_line("control-flow.tig", { on_line = 20, text = "break", indent = 4 }, "while body")
runner:new_line("functions.tig", { on_line = 1, text = "parameter: int,", indent = 2 }, "parameter list beginning")
runner:new_line("functions.tig", { on_line = 2, text = "parameter: int,", indent = 2 }, "parameter list middle")
runner:new_line("functions.tig", { on_line = 4, text = ",parameter: int", indent = 2 }, "parameter list end")
runner:new_line("functions.tig", { on_line = 5, text = "var a := 0", indent = 0 }, "after parameter list")
runner:new_line("functions.tig", { on_line = 7, text = "print(a)", indent = 2 }, "function body")
runner:new_line("functions.tig", { on_line = 9, text = "a,", indent = 6 }, "function call beginning")
runner:new_line("functions.tig", { on_line = 10, text = "a,", indent = 6 }, "function call middle")
runner:new_line("functions.tig", { on_line = 12, text = ",a", indent = 6 }, "function call end")
runner:new_line("functions.tig", { on_line = 13, text = "; print(a)", indent = 4 }, "after function call")
runner:new_line("functions.tig", { on_line = 14, text = "var a := 12", indent = 0 }, "after function declaration")
runner:new_line("groupings.tig", { on_line = 2, text = "var b := 0", indent = 2 }, "let declarations")
runner:new_line("groupings.tig", { on_line = 3, text = "a := a + 1", indent = 2 }, "after 'in'")
runner:new_line("groupings.tig", { on_line = 4, text = "a := a + 1;", indent = 4 }, "sequence")
runner:new_line("groupings.tig", { on_line = 8, text = "a := a + 1;", indent = 2 }, "after sequence")
runner:new_line("groupings.tig", { on_line = 10, text = "+ 1", indent = 0 }, "after 'end'")
runner:new_line(
"values-and-expressions.tig",
{ on_line = 4, text = "field: record,", indent = 4 },
"record type beginning"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 5, text = "field: record,", indent = 4 },
"record type middle"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 7, text = ",field: record", indent = 4 },
"record type end"
)
runner:new_line("values-and-expressions.tig", { on_line = 8, text = "var a := 0", indent = 2 }, "after record type")
runner:new_line(
"values-and-expressions.tig",
{ on_line = 10, text = "0", indent = 4 },
"variable declaration init value"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 11, text = "+ a", indent = 4 },
"variable declaration init follow-up"
)
runner:new_line("values-and-expressions.tig", { on_line = 13, text = "a", indent = 4 }, "array index")
runner:new_line("values-and-expressions.tig", { on_line = 14, text = "+ a", indent = 4 }, "array index follow-up")
runner:new_line("values-and-expressions.tig", { on_line = 15, text = "+ a", indent = 2 }, "after array value")
runner:new_line("values-and-expressions.tig", { on_line = 18, text = "a", indent = 4 }, "array expression size")
runner:new_line(
"values-and-expressions.tig",
{ on_line = 20, text = "of", indent = 4 },
"array expression after size"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 21, text = "a", indent = 4 },
"array expression init value"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 25, text = "field = 0,", indent = 4 },
"record expression beginning"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 26, text = "field = 0,", indent = 4 },
"record expression middle"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 28, text = ",field = 0", indent = 4 },
"record expression end"
)
runner:new_line(
"values-and-expressions.tig",
{ on_line = 29, text = "a := 0", indent = 2 },
"after record expression"
)
end)
end)