Annotation of parser3/tests/160.html, revision 1.4
1.1 misha 1: @main[]
1.3 misha 2: $sDir[outputs/160]
3: $iStep(1)
4: $iSleepTime(3)
5: $iCacheTime(2)
1.1 misha 6:
1.3 misha 7: <table border="1" cellpadding="3">
8: <tr>
1.4 ! misha 9: <th>Info</th>
1.3 misha 10: <th>File: 1</th>
11: <th>File: 2</th>
12: <th>File: 3</th>
1.4 ! misha 13: <th>File: 4</th>
1.3 misha 14: </tr>
1.1 misha 15:
1.4 ! misha 16: # row 1
! 17: <tr valign="top">
! 18: <td>Exec body on 1st step, then just get cached result</td>
1.3 misha 19: <td>
20: ^do[1](3){One}
21: </td>
22: <td>
23: ^do[2](3){Two}
24: </td>
25: <td>
26: ^do[3](3){Three}
27: </td>
1.4 ! misha 28: <td><br /></td>
1.3 misha 29: </tr>
1.1 misha 30:
1.3 misha 31:
1.4 ! misha 32: #row 2
! 33: <tr valign="top">
! 34: <td>Value in cache not expired yet.</td>
1.3 misha 35: <td><br /></td>
36: <td><br /></td>
37: <td>
38: ^do[3](3){
39: ^method[]
40: }{
41: $exception.handled(1)
42: ^cache(2)
1.4 ! misha 43: Error while executing body
1.3 misha 44: }
45: </td>
46: </tr>
47:
48: # wait till cache expire
1.4 ! misha 49: <tr valign="top">
! 50: <td>Wait for 3 secs. Cache expired for sure.</td>
1.3 misha 51: <td colspan="3">
52: ^sleep($iSleepTime)
53: ^^sleep($iSleepTime)
54: </td>
1.4 ! misha 55: <td><br /></td>
1.3 misha 56: </tr>
57:
58:
1.4 ! misha 59: # row 3
! 60: <tr valign="top">
! 61: <td>
! 62: 1. Body code has an exception but force get cached result<br />
! 63: 2. Execute body and set ^^cache(0) for prevent cacheing<br />
! 64: 3. Body code has an exception, execute catch section and set ^^cache(0)
! 65: </td>
1.3 misha 66: <td>
67: ^do[1](3){
68: ^method[]
69: }{
70: ^cache(1)
71: $exception.handled[cache]
1.4 ! misha 72: force get cached resuls
1.3 misha 73: }
74: </td>
75:
76: <td>
77: ^do[2](3){
78: Two
79: ^cache(0)
80: }
81: </td>
82:
83: <td>
84: ^do[3](3){
85: ^method[]
86: }{
87: $exception.handled(1)
88: ^cache(0)
1.4 ! misha 89: Catch section results
! 90: }
! 91: </td>
! 92:
! 93: <td>
! 94: ^do[4](3){
! 95: ^method[]
1.3 misha 96: }
97: </td>
98:
99:
100: </tr>
101: </table>
102:
103:
1.4 ! misha 104: @do[sFile;iSteps;jBody;jExceptionHandler][i;n;bProcessBody;bProcessErrorHandler;iTime;sBody;bError]
1.3 misha 105: ^for[i](1;$iSteps){
106: $iTime[]
107: $bProcessBody(0)
108: $bProcessErrorHandler(0)
1.4 ! misha 109:
! 110: $nTry(0)
! 111: $nCatch(0)
! 112: ^try{
! 113: $sBody[^cache[$sDir/$sFile]($iCacheTime){
! 114: ^nTry.inc(1)
! 115: $jBody ($i)
! 116: $bProcessBody(1)
! 117: $iTime(^cache[])
! 118: }{$bProcessErrorHandler(1)^nCatch.inc(1)$jExceptionHandler}]
! 119:
! 120: ^if($bProcessBody){
! 121: Executed body, ^^cache[] value ^if(def $iTime){defined}{undefined},
1.3 misha 122: }{
1.4 ! misha 123: ^if($bProcessErrorHandler){
! 124: Processing catch section,
! 125: }{
! 126: Get cached result,
! 127: }
1.1 misha 128: }
1.4 ! misha 129: }{
! 130: $bError(1)
! 131: $exception.handled(1)
1.1 misha 132: }
1.3 misha 133:
1.4 ! misha 134: ^if($bError){
! 135: Error. Body executed $nTry times, catch executed $nCatch times.
! 136: }{
! 137: result: '$sBody'
! 138: }
1.3 misha 139: }[<br />]
140: ^iStep.inc(1)
1.1 misha 141:
E-mail: