annotate examples/blog/src/private/tools/test.luan @ 1016:8c13b9224cff

remove returnBuffer()
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 24 Oct 2016 01:38:00 -0600
parents e2eb55d86bb2
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 }
789
e2eb55d86bb2 add http/tools
Franklin Schmidt <fschmidt@gmail.com>
parents: 779
diff changeset
21 local Db = require "site:/lib/Db.luan"
598
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