Mercurial Hosting > luan
annotate blog/src/lib/test.luan @ 629:35dde32c02ab 0.15
change String.matches()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Jan 2016 23:07:52 -0700 |
parents | e930f92d0f61 |
children | ca169567ce07 |
rev | line source |
---|---|
598 | 1 local Luan = require "luan:Luan" |
2 local error = Luan.error | |
3 local to_string = Luan.to_string or error() | |
4 local Http = require "luan:http/Http" | |
5 local Http_test = require "luan:http/Http_test" | |
6 local init = Http_test.init or error() | |
7 local get_page = Http_test.get_page or error() | |
8 local Io = require "luan:Io" | |
9 local print = Io.print or error() | |
10 local String = require "luan:String" | |
629
35dde32c02ab
change String.matches()
Franklin Schmidt <fschmidt@gmail.com>
parents:
598
diff
changeset
|
11 local matches = String.matches or error() |
598 | 12 |
13 Http.uncache_site() | |
14 | |
15 local Db_mod = require "site:/lib/Db_mod" | |
16 | |
17 Db_mod.lucene_dir = "site:/private/local/lucene_test" | |
18 local Db = require "site:/lib/Db" | |
19 Db.delete_all() | |
20 | |
21 local Post = require "site:/lib/Post" | |
22 local page | |
23 | |
24 print 'go' | |
25 | |
26 init() | |
27 print '/' | |
28 get_page '/' | |
29 | |
30 init() | |
31 print '/new' | |
32 get_page '/new' | |
33 | |
34 init() | |
35 Http.request.parameter.subject = 'test' | |
36 Http.request.parameter.content = 'this is a test' | |
37 Http.request.parameter.save = 'whatever' | |
38 print '/new submit' | |
39 get_page '/new' | |
40 local posts = Post.get_all() | |
41 #posts == 1 or error() | |
42 local post_id = to_string(posts[1].id) | |
43 | |
44 init() | |
45 Http.request.parameter.post = post_id | |
46 print '/edit' | |
47 get_page '/edit' | |
48 | |
49 init() | |
50 Http.request.parameter.post = post_id | |
51 Http.request.parameter.subject = 'test' | |
52 Http.request.parameter.content = 'this is an edit' | |
53 Http.request.parameter.save = 'whatever' | |
54 print '/edit submit' | |
55 get_page '/edit' | |
56 | |
57 init() | |
58 print '/ again' | |
59 page = get_page '/' | |
629
35dde32c02ab
change String.matches()
Franklin Schmidt <fschmidt@gmail.com>
parents:
598
diff
changeset
|
60 matches(page,'this is an edit') or error() |
598 | 61 |
62 print 'done' |