Mercurial Hosting > luan
comparison scripts/test.luan @ 693:ca169567ce07
module URIs must now include ".luan"
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 19 Apr 2016 15:54:11 -0600 |
| parents | 195a64f948f2 |
| children | 5e3970ccd86a |
comparison
equal
deleted
inserted
replaced
| 692:7bd97d642f37 | 693:ca169567ce07 |
|---|---|
| 1 local Binary = require "luan:Binary" | 1 local Binary = require "luan:Binary.luan" |
| 2 local Html = require "luan:Html" | 2 local Html = require "luan:Html.luan" |
| 3 local Io = require "luan:Io" | 3 local Io = require "luan:Io.luan" |
| 4 local Luan = require "luan:Luan" | 4 local Luan = require "luan:Luan.luan" |
| 5 local Math = require "luan:Math" | 5 local Math = require "luan:Math.luan" |
| 6 local Package = require "luan:Package" | 6 local Package = require "luan:Package.luan" |
| 7 local String = require "luan:String" | 7 local String = require "luan:String.luan" |
| 8 local Table = require "luan:Table" | 8 local Table = require "luan:Table.luan" |
| 9 local Thread = require "luan:Thread" | 9 local Thread = require "luan:Thread.luan" |
| 10 local Time = require "luan:Time" | 10 local Time = require "luan:Time.luan" |
| 11 local Hosting = require "luan:host/Hosting" | 11 local Hosting = require "luan:host/Hosting.luan" |
| 12 local Http = require "luan:http/Http" | 12 local Http = require "luan:http/Http.luan" |
| 13 local Http_test = require "luan:http/Http_test" | 13 local Http_test = require "luan:http/Http_test.luan" |
| 14 local Server = require "luan:http/Server" | 14 local Server = require "luan:http/Server.luan" |
| 15 local Lucene = require "luan:lucene/Lucene" | 15 local Lucene = require "luan:lucene/Lucene.luan" |
| 16 local Versioning = require "luan:lucene/Versioning" | 16 local Versioning = require "luan:lucene/Versioning.luan" |
| 17 local Mail = require "luan:mail/Mail" | 17 local Mail = require "luan:mail/Mail.luan" |
| 18 local Stripe = require "luan:stripe/Stripe" | 18 local Stripe = require "luan:stripe/Stripe.luan" |
| 19 | 19 |
| 20 local error = Luan.error | 20 local error = Luan.error |
| 21 local range = Luan.range or error() | 21 local range = Luan.range or error() |
| 22 local trim = String.trim or error() | 22 local trim = String.trim or error() |
| 23 local find = String.find or error() | 23 local find = String.find or error() |
| 24 local init = Http_test.init or error() | 24 local init = Http_test.init or error() |
| 25 local get_page = Http_test.get_page or error() | 25 local get_page = Http_test.get_page or error() |
| 26 local Ab_testing = require "luan:lucene/Ab_testing" | 26 local Ab_testing = require "luan:lucene/Ab_testing.luan" |
| 27 | 27 |
| 28 | 28 |
| 29 local function print(...) | 29 local function print(...) |
| 30 Io.print_to(Io.stderr,...) | 30 Io.print_to(Io.stderr,...) |
| 31 end | 31 end |
| 32 | 32 |
| 33 function Io.schemes.site(path,add_extension) | 33 function Io.schemes.site(path) |
| 34 return Io.uri( "luan:http"..path, add_extension ) | 34 return Io.uri( "luan:http"..path ) |
| 35 end | 35 end |
| 36 | 36 |
| 37 local page | 37 local page |
| 38 | 38 |
| 39 init() | 39 init() |
| 40 Http.request.parameter.code = "require('luan:Io').print 'hi'" | 40 Http.request.parameter.code = "require('luan:Io.luan').print 'hi'" |
| 41 page = get_page "/run" | 41 page = get_page "/run" |
| 42 trim(page) == "hi" or error "failed" | 42 trim(page) == "hi" or error "failed" |
| 43 | 43 |
| 44 init() | 44 init() |
| 45 Http.request.parameter.cmd = "'ab'..'cd'" | 45 Http.request.parameter.cmd = "'ab'..'cd'" |
| 74 end | 74 end |
| 75 | 75 |
| 76 init() | 76 init() |
| 77 ab_testing.web_page{"All","null"}() | 77 ab_testing.web_page{"All","null"}() |
| 78 | 78 |
| 79 local Web_search = require "luan:lucene/Web_search" | 79 local Web_search = require "luan:lucene/Web_search.luan" |
| 80 local web_search = Web_search.of(db) | 80 local web_search = Web_search.of(db) |
| 81 | 81 |
| 82 init() | 82 init() |
| 83 web_search() | 83 web_search() |
| 84 | 84 |
| 89 web_search() | 89 web_search() |
| 90 | 90 |
| 91 | 91 |
| 92 -- website | 92 -- website |
| 93 | 93 |
| 94 function Io.schemes.site(path,add_extension) | 94 function Io.schemes.site(path) |
| 95 return Io.uri( "file:../website/src"..path, add_extension ) | 95 return Io.uri( "file:../website/src"..path ) |
| 96 end | 96 end |
| 97 | 97 |
| 98 init(); get_page "/" | 98 init(); get_page "/" |
| 99 init(); get_page "/docs.html" | 99 init(); get_page "/docs.html" |
| 100 init(); get_page "/tutorial.html" | 100 init(); get_page "/tutorial.html" |
