lua-users home
lua-l archive

how to test private elements in a module

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


List,

The best thing I could come up with is something like this at the end of a module;

-- test aliases for local functions

if _TEST then

cli.split = split

cli.wordwrap = wordwrap

end

return cli

It’s a small burden on production code and relies on a global ‘_TEST’, works perfectly well, just wondering if there is a better approach, and if not, is there an accepted form of the ‘_TEST’ global by another name?

Thijs


AltStyle によって変換されたページ (->オリジナル) /