[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is it possible to test local funtion with lunit?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 31 Jul 2014 19:35:27 +0200
2014-07-31 17:40 GMT+02:00 Daurnimator <quae@daurnimator.com>:
> On 31 July 2014 01:23, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>>
>> What I have done in some of my modules is to make them
>> return two values. Then `require "mymod"` only accesses the
>> public part, but `mymod, private = dofile"mymod.lua"` also
>> returns a table containing some local functions, cached
>> while they were visible. Then `lunit` or a similar tool can test
>> `mymod`, and some special-purpose tool that I have control
>> over can test `private`.
>
>
> Love it. How did you stumble across this idea? :)
If you edit code, and test it in the interactive shell at the
same time, `require` does not reload just because the
source code has changed, so I got in the habit of using
`dofile` instead.