Mercurial Hosting > luan
diff web/src/luan/modules/web/test.luan @ 271:82a3ebcfbafa
add internal tests
git-svn-id: https://luan-java.googlecode.com/svn/trunk@272 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 31 Oct 2014 04:27:50 +0000 |
parents | |
children | eb27e765affb |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/src/luan/modules/web/test.luan Fri Oct 31 04:27:50 2014 +0000 @@ -0,0 +1,22 @@ +import "luan:Io" +import "luan:web/Http" + + +local function print(...) + Io.print_to(Io.stderr,...) +end + +function Io.protocols.site(path,loading) + return Io.Uri( "luan:web"..path, loading ) +end + + +Http.init_for_test() +Http.request.parameters.code = "print 'hi'" +page = Http.get_page "/web_run" +assert( page.trim() == "hi" ) + +Http.init_for_test() +Http.request.parameters.cmd = "'ab'..'cd'" +page = Http.get_page "/web_shell" +assert( page.find "abcd" )