annotate blog/src/private/tools/test.luan @ 598:e930f92d0f61

add blog test
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 16 Sep 2015 14:32:52 -0600
parents
children ca169567ce07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
598
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local do_file = Luan.do_file
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local try = Luan.try
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Io = require "luan:Io"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local print = Io.print
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Http = require "luan:http/Http"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 return function()
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 Io.stdout = Http.response.text_writer()
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 Http.response.content_type = "text/plain"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 try {
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 function()
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 do_file "site:/lib/test.luan"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 end;
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 catch = function(e)
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 print()
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 print("error:",e)
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 end;
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 local Db = require "site:/lib/Db"
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 Db.close()
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 end