luc-tielen / lua-quickcheck

Property based testing in Lua, inspired by the original QuickCheck.
MIT License
37 stars 1 forks source link

Fails at launch on call to `describe` #19

Closed nrnrnr closed 5 years ago

nrnrnr commented 5 years ago

Not seeing any sort of "getting started" documentation, I tried just launching the binary, just to see if it installed correctly. I got this error:

nr@homedog ~/n/lua-quickcheck> lqc
Random seed = 1554860331
/usr/bin/lua5.1: ./spec/lqc_gen_spec.lua:16: attempt to call global 'describe' (a nil value)
stack traceback:
        ./spec/lqc_gen_spec.lua:16: in function 'script'
        /usr/local/share/lua/5.1/lqc/cli/app.lua:85: in function 'execute_scripts'
        /usr/local/share/lua/5.1/lqc/cli/app.lua:132: in function 'main'
        ...ocal/lib/luarocks/rocks/lua-quickcheck/0.2-4/bin/lqc:4: in main chunk
        [C]: ?

A quick grep shows that describe is not defined in any .lua file.

luc-tielen commented 5 years ago

That's correct, this library does not use describe, but uses property instead. Examples can be found at https://github.com/luc-tielen/lua-quickcheck/tree/master/spec/fixtures/examples for both Lua and Moonscript.

You can run the properties as follows: lqc --colors spec/fixtures/examples (name of file or directory in channel).

Closing this issue since it is somewhat related to #20.

nrnrnr commented 5 years ago

Definitely helps. But when lqc is invoked without arguments, you might prefer a different error message. Or perhaps this is happenstance and it looks in the current working tree for *.lua files? In which case, perhaps you want to use pcall so you can issue a message that says something on the order of "an error occurred loading property file './spec/lqc_gen_spec.lua'. To see the full error message, re-run with the -v option.

Just a thought.

luc-tielen commented 5 years ago

Oh I see, yes by default it looks for all .lua and .moon files in $PWD. I'll see what I can do to improve the error message, but might take some time since I've been quite busy 😅