Mercurial Hosting > luan
changeset 1225:7d4b5afb636f
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 01 Apr 2018 19:04:43 -0600 |
parents | 4416b9cbebf9 |
children | b6aa2cd51b02 |
files | examples/blog/src/lib/test.luan examples/blog/test.luan examples/blog/test.sh |
diffstat | 3 files changed, 59 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
diff -r 4416b9cbebf9 -r 7d4b5afb636f examples/blog/src/lib/test.luan --- a/examples/blog/src/lib/test.luan Tue Mar 27 16:13:22 2018 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -local Luan = require "luan:Luan.luan" -local error = Luan.error -local to_string = Luan.to_string or error() -local Http = require "luan:http/Http.luan" -local Http_test = require "luan:http/Http_test.luan" -local init = Http_test.init or error() -local get_page = Http_test.get_page or error() -local Io = require "luan:Io.luan" -local print = Io.print or error() -local String = require "luan:String.luan" -local matches = String.matches or error() - -local Db = require "site:/lib/Db.luan" -Db.db = Db.new("site:/private/local/lucene_test") -Db.db.delete_all() - -local Post = require "site:/lib/Post.luan" -local page - -print 'go' - -init() -print '/' -get_page '/' - -init() -print '/new.html' -get_page '/new.html' - -init() -Http.request.parameters.subject = 'test' -Http.request.parameters.content = 'this is a test' -Http.request.parameters.save = 'whatever' -print '/new.html submit' -get_page '/new.html' -local posts = Post.get_all() -#posts == 1 or error() -local post_id = to_string(posts[1].id) - -init() -Http.request.parameters.post = post_id -print '/edit.html' -get_page '/edit.html' - -init() -Http.request.parameters.post = post_id -Http.request.parameters.subject = 'test' -Http.request.parameters.content = 'this is an edit' -Http.request.parameters.save = 'whatever' -print '/edit.html submit' -get_page '/edit.html' - -init() -print '/ again' -page = get_page '/' -matches(page,'this is an edit') or error() - -print 'done'
diff -r 4416b9cbebf9 -r 7d4b5afb636f examples/blog/test.luan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/blog/test.luan Sun Apr 01 19:04:43 2018 -0600 @@ -0,0 +1,58 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local to_string = Luan.to_string or error() +local Http = require "luan:http/Http.luan" +local Http_test = require "luan:http/Http_test.luan" +local init = Http_test.init or error() +local get_page = Http_test.get_page or error() +local Io = require "luan:Io.luan" +local print = Io.print or error() +local String = require "luan:String.luan" +local matches = String.matches or error() + +local Db = require "site:/lib/Db.luan" +Db.db = Db.new("site:/private/local/lucene_test") +Db.db.delete_all() + +local Post = require "site:/lib/Post.luan" +local page + +print 'go' + +init() +print '/' +get_page '/' + +init() +print '/new.html' +get_page '/new.html' + +init() +Http.request.parameters.subject = 'test' +Http.request.parameters.content = 'this is a test' +Http.request.parameters.save = 'whatever' +print '/new.html submit' +get_page '/new.html' +local posts = Post.get_all() +#posts == 1 or error() +local post_id = to_string(posts[1].id) + +init() +Http.request.parameters.post = post_id +print '/edit.html' +get_page '/edit.html' + +init() +Http.request.parameters.post = post_id +Http.request.parameters.subject = 'test' +Http.request.parameters.content = 'this is an edit' +Http.request.parameters.save = 'whatever' +print '/edit.html submit' +get_page '/edit.html' + +init() +print '/ again' +page = get_page '/' +matches(page,'this is an edit') or error() + +print 'done'
diff -r 4416b9cbebf9 -r 7d4b5afb636f examples/blog/test.sh --- a/examples/blog/test.sh Tue Mar 27 16:13:22 2018 -0600 +++ b/examples/blog/test.sh Sun Apr 01 19:04:43 2018 -0600 @@ -1,1 +1,1 @@ -luan luan:http/test.luan src site:/lib/test.luan 2>&1 | tee err +luan luan:http/test.luan src test.luan 2>&1 | tee err