# HG changeset patch # User Adam Chlipala # Date 1294345511 18000 # Node ID 5e03668972ea34f677783bda074a157007a22e6e # Parent dd8eb53da51b11f5eac6ecd0e4ac3caeb1543f18 Utest example diff -r dd8eb53da51b -r 5e03668972ea tests/test.urp --- a/tests/test.urp Thu Jan 06 15:17:15 2011 -0500 +++ b/tests/test.urp Thu Jan 06 15:25:11 2011 -0500 @@ -1,3 +1,4 @@ +path META=../../meta library ../src/ur rewrite all Test/* database dbname=openid diff -r dd8eb53da51b -r 5e03668972ea tests/utest.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/utest.ur Thu Jan 06 15:25:11 2011 -0500 @@ -0,0 +1,46 @@ +style inputs + +structure U = OpenidUser.Make(struct + con cols = [Nam = string] + + val sessionLifetime = 3600 + val afterLogout = bless "/main" + val secureCookies = False + val association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256, + AssociationSessionType = Openid.NoEncryption} + val realm = None + + val creationState = + n <- source ""; + return {Nam = n} + + fun render r = + Name: + + + fun tabulate r = + n <- signal r.Nam; + return {Nam = n} + + fun choose _ r = return r + + val formClass = inputs + end) + +fun wrap title body = + userStuff <- U.main wrap; + return + {[title]} + + {userStuff} + +

{[title]}

+ + {body} +
+ +fun main () = + whoami <- U.current; + wrap "Main page" (case whoami of + None => I don't think you're logged in. + | Some whoami => Apparently you are {[whoami]}!) diff -r dd8eb53da51b -r 5e03668972ea tests/utest.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/utest.urp Thu Jan 06 15:25:11 2011 -0500 @@ -0,0 +1,11 @@ +path META=../../meta +library ../src/ur +rewrite all Utest/* +database dbname=openid +sql utest.sql +allow url http://* +allow url https://* +allow url /* +prefix http://localhost:8080/ + +utest diff -r dd8eb53da51b -r 5e03668972ea tests/utest.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/utest.urs Thu Jan 06 15:25:11 2011 -0500 @@ -0,0 +1,1 @@ +val main : unit -> transaction page