4 ms·
Busted: elegant unit testing for Lua
- ajacksified 14y agoWe also broke out the assert library (https://github.com/Olivine-Labs/luassert https://github.com/Olivine-Labs/luassert) and the realllly basic beginnings of a string key/value store for i18n (https://github.com/Olivine-Labs/say https://github.com/Olivine-Labs/say) while building this. Luassert is a drop-in replacement for lua's built-in assert, and you can use it in any Lua testing lib (like lunit.) These will be thoroughly documented soon™. busted is inspired by frameworks like Mocha and Jasmine, and comes bundled with support to easily change the output functionality, write your own asserts, chain and negate asserts, and integrates an i18n library so that you can customize the language in the output. It installs using the luarocks package manager.
- exogen 14y agoSorry to be off-topic, but is there secretly some good Lua documentation out there people use? While learning Lua yesterday (for use with Redis), I was astonished at how poor the official docs are. Even the book and the Lua Users wiki aren't that impressive. They all appear to be stuck in 1995.
- aaronblohowiak 14y agoOooh, good point. I will create a super-quick and dirty "Lua for Redis" tutorial for EVALSHA.com (pull requests encouraged!)
- daurnimator 14y agoThe reference manual is fantastic: http://www.lua.org/manual/5.1/manual.html http://www.lua.org/manual/5.1/manual.html I rarely need to refer to anything else. When learning you should read PiL (Programming in Lua)
- readymade 14y agoBy "poor" do you mean information poor, or plain? I can't speak for everyone else, but in my experience the reference manual is quite complete, and Programming in Lua is perhaps one of the best technical books I've ever read when it comes to concision and clarity.
- kephra 14y agoI think the basic documentation of Lua itself, the reference manual and the PiL are great. But documentation of 3rd party Lua modules is substandard, if I compare them to CPAN.
- tedunangst 14y agoWhat's wrong with 1995?
- snogglethorpe 14y agoEr, what does "stuck in 1995" mean, exactly, for documentation? The Lua reference manual is, I think, a pretty good reference manual. It's quite complete, well-indexed, and reasonably well organized. If you're simply annoyed by having to page through the index to look for a function, you can try the search-based version of the reference manual, at http://pgl.yoyo.org/luai/i/about http://pgl.yoyo.org/luai/i/about The reference manual is, however, a reference manual, and doesn't have much in the way of a high-level overview of various features, or examples. For those things, PiL ("Programming in Lua") is a much better resource. The latest version of PiL is a real you-gotta-pay-money book, but a slightly older version is available online. For both info about the book, and the online version, see http://www.lua.org/pil/ http://www.lua.org/pil/
- endgame 14y agoI'm most impressed by the fact that the first thing you are hit with is a thorough and readable code sample.