Skip to content

Allow accessing private mod variables #66

@S-S-X

Description

@S-S-X

This should allow retrieving local variables and functions for validation and unit tests.

For example could be mineunit:get_local("init.lua", "secretdata") to get local secretdata = "internal stuff" defined in mod init.lua.

Internal functions could be tested with

it("returns Hello World", function()
  local fn = mineunit:get_local("init.lua", "hello")
  assert.is_function(fn)
  assert.equals("Hello World", fn("World"))
end)

When mod init.lua contains

local function hello(msg)
  return "Hello " .. msg
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    Status

    In review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions