diff --git a/test/indent/classes.tig b/test/indent/classes.tig new file mode 100644 index 0000000..542a40e --- /dev/null +++ b/test/indent/classes.tig @@ -0,0 +1,14 @@ +class A { + var a := 12 + + method method() : int = 1 +} + +type B = class extends A { + var b := 27 + + method another_method() = ( + print("called"); + self.b + self.method() + ) +} diff --git a/test/indent_spec.lua b/test/indent_spec.lua index f414d60..d158bdf 100644 --- a/test/indent_spec.lua +++ b/test/indent_spec.lua @@ -30,6 +30,16 @@ describe("indent Tiger:", function() end) describe("new line:", function() + runner:new_line("classes.tig", { on_line = 1, text = "var a := 0", indent = 2 }, "class declaration beginning", XFAIL) + 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", XFAIL) + 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", XFAIL) + 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("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'", XFAIL) runner:new_line("groupings.tig", { on_line = 4, text = "a := a + 1;", indent = 4 }, "sequence", XFAIL)