[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Is it possible to test local funtion with lunit?
From:       Dirk Laurie <dirk.laurie () gmail ! com>
Date:       2014-07-31 17:35:27
Message-ID: CABcj=tnSki1AQmf6KO9HFtQ4UXMKRHn7R=rUtCV9-ZjR9gBseQ () mail ! gmail ! com
[Download RAW message or body]

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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic