lua-users home
lua-l archive

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


On 9/27/07, Duck <duck@roaming.ath.cx> wrote:
>
> > lua: main.lua:31: assertion failed!
> > stack traceback:
> >         [C]: in function 'assert'
> >         main.lua:31: in function 'checkout'
> >         main.lua:99: in main chunk
> >         (tail call): ?
> >         all.lua:69: in main chunk
> >         [C]: ?
>
> Bah, humbug! I get this, too. Some shell/TERM/readline/redirecton
> weirdness? Bash overcoolness?
>
> At this point the test script is typing commands into the Lua interpreter
> and seeing that they work. Ignoring the details, ignoring the Lua prompts,
> and simplifying to a single command, the script expects to test that if I
> do this:
>
>    $ lua
>
> and then enter this command:
>
>    = 6
>
> then the interpreter will spit out:
>
>    6
>
> Which it does.
>
> OK, so I started to automate this myself. Like this:
>
>    $ echo '= 6' | lua -i
>
> and Lua spits out:
>
>    6
>
> And then:
>
>    $ echo '= 6' | lua -i > banana
>
> followed by:
>
>    $ cat banana
>
> in which I get the expected:
>
>    6
>
> But when I put the '= 6' inside a file (as main.lua does) and do this:
>
>    $ lua -i < filecontainingequals6 > banana
>
> and then:
>
>    $ cat banana
>
> I get the input echoed, plus the output, like this:
>
>    = 6
>    6
>
> WTF!?!
>
> So I altered main.lua so that the tests which run commands with both stdin
> and stdout redirected didn't do 'lua -i < in > out' but instead did 'cat
> in | lua -i > out'.
>
> That was OK.

You get this if Lua is built with readline support. I could reproduce
the behavior you described when using readline and the expected
behavior of the test suite when building without it.

-- Hisham