Mercurial Hosting > luan
comparison web/src/luan/modules/web/web_run.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 | 392105b660d7 |
children | b669cdaf54b7 |
comparison
equal
deleted
inserted
replaced
270:b2c20fdcf42a | 271:82a3ebcfbafa |
---|---|
1 import "Io" | 1 import "luan:Io" |
2 import "web/Http" | 2 import "luan:web/Http" |
3 import "String" | 3 import "luan:String" |
4 | 4 |
5 local function lines(s) | 5 local function lines(s) |
6 local matcher = String.gmatch(s,"([^\n]*)\n|([^\n])+$") | 6 local matcher = s.gmatch "([^\n]*)\n|([^\n])+$" |
7 return function() | 7 return function() |
8 local m1, m2 = matcher() | 8 local m1, m2 = matcher() |
9 return m1 or m2 | 9 return m1 or m2 |
10 end | 10 end |
11 end | 11 end |
31 } | 31 } |
32 try | 32 try |
33 local run = load(code,"<web_run>",env) | 33 local run = load(code,"<web_run>",env) |
34 run() | 34 run() |
35 catch e do | 35 catch e do |
36 Http.response.set_content_type "text/plain" | 36 Http.response.content_type = "text/plain" |
37 print(e) | 37 print(e) |
38 print() | 38 print() |
39 print() | 39 print() |
40 print_with_line_numbers(code) | 40 print_with_line_numbers(code) |
41 end | 41 end |