annotate blog/src/private/tools/test.luan @ 722:647602e8291a

add url options
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 03 Jun 2016 17:51:58 -0600
parents ca169567ce07
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
693
ca169567ce07 module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents: 598
diff changeset
1 local Luan = require "luan:Luan.luan"
598
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
693
ca169567ce07 module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents: 598
diff changeset
4 local Io = require "luan:Io.luan"
598
e930f92d0f61 add blog test
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local print = Io.print
693
ca169567ce07 module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents: 598
diff changeset
6 local Http = require "luan:http/Http.luan"
598
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