Changeset 1345:b24305dd9edb
- Timestamp:
- 09/09/09 11:01:08 (2 years ago)
- Branch:
- default
- Location:
- trunk/tests
- Files:
-
- 6 edited
-
cgi_test/index.tpl (modified) (1 diff)
-
cgi_test/menu.tpl (modified) (1 diff)
-
cgi_test/test.cc (modified) (1 diff)
-
cgi_test/test.tpl (modified) (8 diffs)
-
cgifast_test/test.cc (modified) (7 diffs)
-
cgifast_test/test.tpl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/cgi_test/index.tpl
r1110 r1345 1 index.tpl 2 3 <(> 1 <(if $main)> 4 2 <(include $main)> 5 6 <(print "a=", $a, " b=", $b)> 7 8 <(if $a!=$b)> 9 a != b 10 <(else)> 11 a == b 12 <(fi)> 13 <)> 14 15 <(include $main)> 3 <(else)> 4 <(include "index.tpl")> 5 <(fi)> 16 6 17 7 <(print "a=", $a, " b=", $b)> -
trunk/tests/cgi_test/menu.tpl
r1110 r1345 1 menu.tpl 2 3 test recursion includes 4 <(> 5 <(include index.tpl)> 6 <(include test.tpl)> 7 <)> 1 <(* test recursion includes *)> 8 2 9 3 <(include index.tpl)> -
trunk/tests/cgi_test/test.cc
r1312 r1345 75 75 d.HEADERS[cgi::RESPONSE_HEADER_CONTENTTYPE] = "text/html"; 76 76 77 d.setCookie(cookie("test", " Ni@m"));77 d.setCookie(cookie("test", "cookie")); 78 78 79 79 exchange *io = d; -
trunk/tests/cgi_test/test.tpl
r1110 r1345 12 12 13 13 <pre> 14 15 14 <(* test template *)> 16 15 … … 18 17 <(assign b = 2)> 19 18 20 included menu.tpl:<(include "menu.tpl")>19 <(include "menu.tpl")> 21 20 22 21 <(assign b = $a)> 23 22 24 included $main <(include $main)> 25 26 ********** 23 <(include $main)> 27 24 28 25 <(> <( not )> parsed area <)> 29 26 30 **********27 <(print "test=", $test)> 31 28 32 simple 'if' statement33 34 <(>35 <(print $test)>36 <(if $test!=test )>37 equal38 <(else)>39 not equal40 <(fi)>41 <)>42 43 <(print $test)>44 29 <(if $test!=test )> 45 equal30 $test != 'test' 46 31 <(else)> 47 not equal32 $test == 'test' 48 33 <(fi)> 49 50 **********51 52 nested 'if' statements53 54 <(>55 <(if $test )>56 $test57 <(if $test==test )>58 test59 <(fi)>60 <(if $test!=test )>61 !test62 <(fi)>63 64 <(if $test )>65 test66 <(if $test==test )>67 <(print $test)>68 <(else)>69 NULL70 <(fi)>71 <(else)>72 <(if $test!=test )>73 !test74 <(fi)>75 <(if false )>76 WTF?77 <(fi)>78 <(fi)>79 80 <(if 3>2 )>81 3>282 <(fi)>83 84 <(if 3<2 )>85 WTF?86 <(fi)>87 88 <(89 if90 ! `false`91 )>92 !false93 <(fi)>94 95 <(if!false)>!false<(fi)>96 97 <(if ! 'false' )>98 !'false'99 <(fi)>100 <(if ! "false" )>101 ! "false"102 <(fi)>103 <(fi)>104 <)>105 34 106 35 <(if $test )> 107 36 $test 108 37 <(if $test==test )> 109 test38 $test == 'test' 110 39 <(fi)> 111 40 <(if $test!=test )> 112 !test113 <(fi)> 114 41 $test != 'test' 42 <(fi)> 43 115 44 <(if $test )> 116 45 test 117 46 <(if $test==test )> 118 <(print $test)>47 $test == 'test' 119 48 <(else)> 120 NULL49 $test != 'test' 121 50 <(fi)> 122 <(else)> 51 <(else)> 123 52 <(if $test!=test )> 124 !test125 <(fi)> 53 $test != 'test' 54 <(fi)> 126 55 <(if false )> 127 56 WTF? 128 57 <(fi)> 129 <(fi)> 130 58 <(fi)> 59 131 60 <(if 3>2 )> 132 61 3>2 … … 136 65 WTF? 137 66 <(fi)> 138 67 139 68 <( 140 69 if … … 143 72 !false 144 73 <(fi)> 145 74 146 75 <(if!false)>!false<(fi)> 147 76 148 77 <(if ! 'false' )> 149 78 !'false' 150 <(fi)> 79 <(fi)> 151 80 <(if ! "false" )> 152 81 ! "false" 153 <(fi)> 82 <(fi)> 154 83 <(fi)> 155 156 **********157 158 simple 'for' statement159 160 <(>161 <(for $i in $strarr)>162 <(for $j in $i)><(print $j)><(rof)>163 <(rof)>164 165 <(for $b in $strmaparr)>166 <(for $c in $b)>167 |<(print $c)>|<(print $b.one)>168 <(rof)>169 <(rof)>170 171 <(for $c in $strmaparr.1)>172 |<(print $c)>173 <(rof)>174 <)>175 84 176 85 <(for $i in $strarr)> … … 188 97 <(rof)> 189 98 190 **********191 192 namespace193 194 <(>195 <(for $i in $strmaparr)>196 <(for $i in $i)> <(* HERE : '$i in $i' is OK because of the namespace scope *)>197 |<(print $i)>198 <(print $dodo.iterator)>199 <(rof)>200 |<(print $i.one)>201 <(print $dodo.iterator)>202 <(rof)>203 204 <(assign a = test1)>205 206 <(if true )>207 <(assign a = test2)>208 209 <(for $i in $strmaparr)>210 <(for $i => $j in $i)>211 <(if $i == three)>212 <(break 3)>213 <(fi)>214 <(print $i)> - <(print $j)>215 216 <(assign a = test3)>217 <(print $a," must be test3")>218 <(rof)>219 -------220 <(rof)>221 <(print $a," must be test2")>222 <(fi)>223 <(print $a," must be test1")>224 225 <(ns)>226 <(ns)>227 <(assign a = in namespace)>228 <(print $a," must be `in namespace`")>229 <(sn)>230 <(print $a," must be test1")>231 <(sn)>232 <)>233 234 99 <(for $i in $strmaparr)> 235 100 <(for $i in $i)> <(* HERE : '$i in $i' is OK because of the namespace scope *)> … … 243 108 <(assign a = test1)> 244 109 245 <(if true )> 110 <(if true )> 246 111 <(assign a = test2)> 247 112 … … 252 117 <(fi)> 253 118 <(print $i)> - <(print $j)> 254 119 255 120 <(assign a = test3)> 256 <(print $a," must be test3")>121 <(print "$a= '", $a,"' (must be equal to 'test3')")> 257 122 <(rof)> 258 123 ------- 259 <(rof)> 260 <(print $a," must be test2")>124 <(rof)> 125 <(print "$a= '", $a,"' (must be equal to 'test2')")> 261 126 <(fi)> 262 <(print $a," must be test1")>263 127 <(print "$a= '", $a,"' (must be equal to 'test1')")> 128 264 129 <(ns)> 265 130 <(ns)> 266 131 <(assign a = in namespace)> 267 <(print $a," must be `in namespace`")>132 <(print "$a= '", $a,"' (must be equal to 'in namespace')")> 268 133 <(sn)> 269 <(print $a," must be test1")>134 <(print "$a= '", $a,"' (must be equal to 'test1')")> 270 135 <(sn)> 271 272 **********273 274 print statement and variable resolution275 276 <(>277 <(print string literal)>278 <(print {$strmaparr.{0}.{$one}} )>279 <(print $strmaparr.1.{$strmap.{$one}} )>280 <(print $strarr.0.0 )>281 <(print $strmap.one )>282 <(print $strmaparr.0.one )>283 <(print $strmaparr.1.one )>284 <(print $strmaparr.1.{$strmap.{$one}} , -- , {$strmaparr.{0}.{$one}})>285 <(print $dodo.version, " ", $dodo)>286 <)>287 136 288 137 <(print string literal)> … … 295 144 <(print $strmaparr.1.{$strmap.{$one}} , -- , {$strmaparr.{0}.{$one}})> 296 145 <(print $dodo.version, " ", $dodo)> 297 298 146 </pre> -
trunk/tests/cgifast_test/test.cc
r1312 r1345 19 19 20 20 void 21 cgif(exchange &fcgi)21 handler(exchange &ex) 22 22 { 23 23 using namespace cgi; 24 24 25 dialogue cgit(fcgi, true);25 dialogue d(ex, true); 26 26 27 cgit.setCookie(cookie("test", "Ni@m"));27 d.setCookie(cookie("test", "Ni@m")); 28 28 29 29 ///increment counter in shared memory … … 31 31 sh.release(); 32 32 33 exchange *io = cgit;33 exchange *io = d; 34 34 io->writeString("The headers thould be already printed successfully.<br>"); 35 35 … … 38 38 #endif 39 39 40 fcgi.writeString("counter: " + tools::string::iToString(*inc) + "<br>");40 ex.writeString("counter: " + tools::string::iToString(*inc) + "<br>"); 41 41 42 fcgi.writeString("GET[\"argument\"]: " + cgit.GET["argument"] + "<br>");43 fcgi.writeString("POST[\"hidden\"]: " + cgit.POST["hidden"] + "<br>");44 fcgi.writeString("POST[\"test\"]: " + cgit.POST["test"] + "<br>");45 fcgi.writeString("ENVIRONMENT[CGI_ENVIRONMENT_QUERYSTRING]: " + cgit.ENVIRONMENT[cgi::ENVIRONMENT_QUERYSTRING] + "<br>");46 fcgi.writeString("COOKIES[\"test\"]: " + cgit.COOKIES["test"] + "<br>");47 fcgi.writeString("FILES[\"file\"].size: " + tools::string::iToString(cgit.FILES["file"].size) + "<br>");48 fcgi.writeString("tpl::processor:<br>");42 ex.writeString("GET[\"argument\"]: " + d.GET["argument"] + "<br>"); 43 ex.writeString("POST[\"hidden\"]: " + d.POST["hidden"] + "<br>"); 44 ex.writeString("POST[\"test\"]: " + d.POST["test"] + "<br>"); 45 ex.writeString("ENVIRONMENT[CGI_ENVIRONMENT_QUERYSTRING]: " + d.ENVIRONMENT[cgi::ENVIRONMENT_QUERYSTRING] + "<br>"); 46 ex.writeString("COOKIES[\"test\"]: " + d.COOKIES["test"] + "<br>"); 47 ex.writeString("FILES[\"file\"].size: " + tools::string::iToString(d.FILES["file"].size) + "<br>"); 48 ex.writeString("tpl::processor:<br>"); 49 49 50 50 try 51 51 { 52 processor cgip;52 processor p; 53 53 54 cgip.assign("test", "hoho");55 cgip.assign("one", "one");54 p.assign("test", "test"); 55 p.assign("one", "one"); 56 56 57 57 dodoStringArray strarr; … … 59 59 strarr.push_back("two"); 60 60 strarr.push_back("three"); 61 cgip.assign("strarr", strarr);61 p.assign("strarr", strarr); 62 62 63 63 dodoStringMap strmap; … … 65 65 strmap["two"] = "two"; 66 66 strmap["three"] = "three"; 67 cgip.assign("strmap", strmap);67 p.assign("strmap", strmap); 68 68 69 69 dodoArray<dodoStringMap> strmaparr; … … 71 71 strmap["one"] = "three"; 72 72 strmaparr.push_back(strmap); 73 cgip.assign("strmaparr", strmaparr);73 p.assign("strmaparr", strmaparr); 74 74 75 cgip.processFile("test.tpl", *io);75 p.processFile("test.tpl", *io); 76 76 } 77 77 catch (dodo::exception::basic ex) 78 78 { 79 fcgi.writeString(ex.errStr + " " + tools::string::lToString(ex.line));79 ex.writeString(ex.errStr + " " + tools::string::lToString(ex.line)); 80 80 } 81 81 82 fcgi.writeString("<br>");82 ex.writeString("<br>"); 83 83 84 84 inc = (int *)sh.acquire(); … … 108 108 server c; 109 109 #endif 110 \ 111 c.serve(&cgif); 110 c.serve(&handler); 112 111 113 112 delete shared; -
trunk/tests/cgifast_test/test.tpl
r1110 r1345 1 2 1 <form enctype="multipart/form-data" method="POST"> 3 2 <input type="file" name="file"> 3 <input type="hidden" name="hidden" value="post"> 4 <input type="text" name="text" value="text"> 4 5 <input type="submit" value="push file"> 6 </form> 7 <form method="POST"> 8 <input type="hidden" name="hidden" value="post"> 9 <input type="text" name="text" value="text"> 10 <input type="submit" value="push"> 5 11 </form> 6 12 7 13 <pre> 14 <(* test template *)> 8 15 9 <(* test template *)> 16 <(assign a = 1)> 17 <(assign b = 2)> 18 19 <(assign b = $a)> 10 20 11 21 <(> <( not )> parsed area <)> 12 22 13 **********23 <(print "test=", $test)> 14 24 15 simple 'if' statement16 17 <(>18 <(print $test)>19 <(if $test!=test )>20 equal21 <(else)>22 not equal23 <(fi)>24 <)>25 26 <(print $test)>27 25 <(if $test!=test )> 28 equal26 $test != 'test' 29 27 <(else)> 30 not equal28 $test == 'test' 31 29 <(fi)> 32 33 **********34 35 nested 'if' statements36 37 <(>38 <(if $test )>39 $test40 <(if $test==test )>41 test42 <(fi)>43 <(if $test!=test )>44 !test45 <(fi)>46 47 <(if $test )>48 test49 <(if $test==test )>50 <(print $test)>51 <(else)>52 NULL53 <(fi)>54 <(else)>55 <(if $test!=test )>56 !test57 <(fi)>58 <(if false )>59 WTF?60 <(fi)>61 <(fi)>62 63 <(if 3>2 )>64 3>265 <(fi)>66 67 <(if 3<2 )>68 WTF?69 <(fi)>70 71 <(72 if73 ! `false`74 )>75 !false76 <(fi)>77 78 <(if!false)>!false<(fi)>79 80 <(if ! 'false' )>81 !'false'82 <(fi)>83 <(if ! "false" )>84 ! "false"85 <(fi)>86 <(fi)>87 <)>88 30 89 31 <(if $test )> 90 32 $test 91 33 <(if $test==test )> 92 test34 $test == 'test' 93 35 <(fi)> 94 36 <(if $test!=test )> 95 !test96 <(fi)> 97 37 $test != 'test' 38 <(fi)> 39 98 40 <(if $test )> 99 41 test 100 42 <(if $test==test )> 101 <(print $test)>43 $test == 'test' 102 44 <(else)> 103 NULL45 $test != 'test' 104 46 <(fi)> 105 <(else)> 47 <(else)> 106 48 <(if $test!=test )> 107 !test108 <(fi)> 49 $test != 'test' 50 <(fi)> 109 51 <(if false )> 110 52 WTF? 111 53 <(fi)> 112 <(fi)> 113 54 <(fi)> 55 114 56 <(if 3>2 )> 115 57 3>2 … … 119 61 WTF? 120 62 <(fi)> 121 63 122 64 <( 123 65 if … … 126 68 !false 127 69 <(fi)> 128 70 129 71 <(if!false)>!false<(fi)> 130 72 131 73 <(if ! 'false' )> 132 74 !'false' 133 <(fi)> 75 <(fi)> 134 76 <(if ! "false" )> 135 77 ! "false" 136 <(fi)> 78 <(fi)> 137 79 <(fi)> 138 139 **********140 141 simple 'for' statement142 143 <(>144 <(for $i in $strarr)>145 <(for $j in $i)><(print $j)><(rof)>146 <(rof)>147 148 <(for $b in $strmaparr)>149 <(for $c in $b)>150 |<(print $c)>|<(print $b.one)>151 <(rof)>152 <(rof)>153 154 <(for $c in $strmaparr.1)>155 |<(print $c)>156 <(rof)>157 <)>158 80 159 81 <(for $i in $strarr)> … … 171 93 <(rof)> 172 94 173 **********174 175 namespace176 177 <(>178 <(for $i in $strmaparr)>179 <(for $i in $i)> <(* HERE : '$i in $i' is OK because of the namespace scope *)>180 |<(print $i)>181 <(print $dodo.iterator)>182 <(rof)>183 |<(print $i.one)>184 <(print $dodo.iterator)>185 <(rof)>186 187 <(assign a = test1)>188 189 <(if true )>190 <(assign a = test2)>191 192 <(for $i in $strmaparr)>193 <(for $i => $j in $i)>194 <(if $i == three)>195 <(break 3)>196 <(fi)>197 <(print $i)> - <(print $j)>198 199 <(assign a = test3)>200 <(print $a," must be test3")>201 <(rof)>202 -------203 <(rof)>204 <(print $a," must be test2")>205 <(fi)>206 <(print $a," must be test1")>207 208 <(ns)>209 <(ns)>210 <(assign a = in namespace)>211 <(print $a," must be `in namespace`")>212 <(sn)>213 <(print $a," must be test1")>214 <(sn)>215 <)>216 217 95 <(for $i in $strmaparr)> 218 96 <(for $i in $i)> <(* HERE : '$i in $i' is OK because of the namespace scope *)> … … 226 104 <(assign a = test1)> 227 105 228 <(if true )> 106 <(if true )> 229 107 <(assign a = test2)> 230 108 … … 235 113 <(fi)> 236 114 <(print $i)> - <(print $j)> 237 115 238 116 <(assign a = test3)> 239 <(print $a," must be test3")>117 <(print "$a= '", $a,"' (must be equal to 'test3')")> 240 118 <(rof)> 241 119 ------- 242 <(rof)> 243 <(print $a," must be test2")>120 <(rof)> 121 <(print "$a= '", $a,"' (must be equal to 'test2')")> 244 122 <(fi)> 245 <(print $a," must be test1")>246 123 <(print "$a= '", $a,"' (must be equal to 'test1')")> 124 247 125 <(ns)> 248 126 <(ns)> 249 127 <(assign a = in namespace)> 250 <(print $a," must be `in namespace`")>128 <(print "$a= '", $a,"' (must be equal to 'in namespace')")> 251 129 <(sn)> 252 <(print $a," must be test1")>130 <(print "$a= '", $a,"' (must be equal to 'test1')")> 253 131 <(sn)> 254 255 **********256 257 print statement and variable resolution258 259 <(>260 <(print string literal)>261 <(print {$strmaparr.{0}.{$one}} )>262 <(print $strmaparr.1.{$strmap.{$one}} )>263 <(print $strarr.0.0 )>264 <(print $strmap.one )>265 <(print $strmaparr.0.one )>266 <(print $strmaparr.1.one )>267 <(print $strmaparr.1.{$strmap.{$one}} , -- , {$strmaparr.{0}.{$one}})>268 <(print $dodo.version, " ", $dodo)>269 <)>270 132 271 133 <(print string literal)> … … 278 140 <(print $strmaparr.1.{$strmap.{$one}} , -- , {$strmaparr.{0}.{$one}})> 279 141 <(print $dodo.version, " ", $dodo)> 280 281 142 </pre>
Note: See TracChangeset
for help on using the changeset viewer.
