Re: [mongrel2] tir, lua, unit tests and require
- From:
- Matt N
- Date:
- 2011-02-05 @ 08:16
Just for the record, I pulled from fossil and...I get the exact opposite results.
When I do tir start, none of my lua files in /app care if I do require
"tir.engine" or require "tir/engine"
When I do tir test, any lua file that does require "tir/engine" hangs the
entire unit test harness. require "tir.engine" works.
In the end not a big deal, but still somewhat mystifying to me. I'm
perfectly willing to chalk it up to Mac OS X fs weirdness. I'll try it on
linux at some point in the future...
Thanks,
Matt
On Feb 4, 2011, at 10:23 PM, Zed A. Shaw wrote:
> On Fri, Feb 04, 2011 at 09:04:18PM -0800, Matt N wrote:
>> According to the PiL book, when you do require "a.b" it translates the
. into the directory path character for the system. This implies to me
that the . character is the right one to use.
>
> For some reason I never do it that way. Not sure why, probably just
> style or a holdover from when I did Lua before. Anyway, I changed it
> all to be . instead of /.
>
>> When I do tir start, none of my lua files in /app care if I do require
"tir.engine" or require "tir/engine"
>> When I do tir test, any lua file that does require "tir.engine" hangs
the entire unit test harness. require "tir/engine" works just fine.
>
> And I ran them just find and it looks like all the tests passed. There
> were a few that broke because the rockspec was moved.
>
>> Maybe it's just me, but three weeks in, modules are my big sore point
with Lua. Can anyone explain the above? Something to do with Tir's
testing harness or telescope? Should I always be using / instead of . in
my require statements?
>
> Looks like it might have been a bug. Grab the latest from fossil and
> try it again.
>
>> (Disclaimer: I love Tir. Makes web dev fun again.)
>
> Glad you like it.
>
> --
> Zed A. Shaw
> http://zedshaw.com/