From b58384e65b9be0a8ac2cd500654492222ce3cfea Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sat, 13 May 2023 00:29:47 +0200 Subject: [PATCH] spec(teal_type_definition): test Record node --- spec/printer/teal_type_definition_spec.tl | 23 +++++++++++++++++++ .../printer/teal_type_definition.tl | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/spec/printer/teal_type_definition_spec.tl b/spec/printer/teal_type_definition_spec.tl index 6a717b8..9c37e19 100644 --- a/spec/printer/teal_type_definition_spec.tl +++ b/spec/printer/teal_type_definition_spec.tl @@ -122,4 +122,27 @@ describe("Teal type definition Printer", function() return Function_Module ]])) + + it("should print nested Record exposed by the module", gen( + { + children = { + { + children = {}, + name = "Nested", + token = "record", + } + }, + name = "Nested_Module", + token = "module", + }, + [[ + -- This file was auto-generated. + + local record Nested_Module + record Nested + end + end + + return Nested_Module + ]])) end) diff --git a/src/awesomewm.d.tl/printer/teal_type_definition.tl b/src/awesomewm.d.tl/printer/teal_type_definition.tl index 7958d39..f43981b 100644 --- a/src/awesomewm.d.tl/printer/teal_type_definition.tl +++ b/src/awesomewm.d.tl/printer/teal_type_definition.tl @@ -37,7 +37,7 @@ local node_printer : { Node.Token : Node_Printer_Function } = { }, ["record"] = { before_node = function(node: Node): string - return "local record " .. node.name + return "record " .. node.name .. "\n" end, on_node = function(node: Node): string return print_children(node)