Hello!
On Wed, Jul 30, 2014 at 11:52 AM, Ryan Schlesinger wrote:
> Do you have any thoughts on trying to unit test lua/moonscript code that
> uses modules from openresty? I’ve been trying to test a reasonably simple
> class that uses resty.string.
I usually use my Test::Nginx::Socket scaffold to drive the test suite
of my lua-resty-* libraries. See
http://search.cpan.org/perldoc?Test%3A%3ANginx%3A%3ASocket
You can check out the existing test suite in lua-resty-string, for example:
https://github.com/openresty/lua-resty-string/tree/master/t
More complicated examples can be found in the lua-resty-dns and
lua-resty-memcached projects including mocked TCP/UDP servers provided
by the test scaffold. The tests are always under the t/ directory.
This test scaffold also drives all my NGINX C modules' test suites,
including ngx_lua's.
Just FYI :)
BTW, please join the openresty-en mailing list and post such questions
there: https://groups.google.com/group/openresty-en Thank you for you
cooperation! I'm cc'ing the list.
Regards,
-agentzh