~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to tads/tads3/test/data/gotofin.t

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "tads.h"
 
2
 
 
3
function _main(args)
 
4
{
 
5
    local i;
 
6
    
 
7
    i = 1;
 
8
 
 
9
    /* this one should fail - transfers into a 'finally' block */
 
10
    if (i > 50)
 
11
        goto label_in_finally;
 
12
    
 
13
    for (local i = 1 ; i <= 100 ; ++i)
 
14
    {
 
15
        /* this one should also fail */
 
16
        if (i > 50)
 
17
            goto label_in_finally;
 
18
 
 
19
        try
 
20
        {
 
21
            "This is a test.";
 
22
 
 
23
            /* 
 
24
             *   this one should fail, too - we can't even transfer into
 
25
             *   our own 'finally' block within a 'try' or 'catch' 
 
26
             */
 
27
            if (i > 30)
 
28
                goto label_in_finally;
 
29
        }
 
30
        finally
 
31
        {
 
32
            "In the 'finally'";
 
33
 
 
34
        label_in_finally:
 
35
            "After the label in the finally!";
 
36
 
 
37
            /* this one should work - it's within the same block */
 
38
            if (i > 75)
 
39
                goto label_in_finally;
 
40
 
 
41
            try
 
42
            {
 
43
                "Sub-try";
 
44
            }
 
45
            finally
 
46
            {
 
47
                /* this one should also work */
 
48
                goto label_in_finally;
 
49
            }
 
50
        }
 
51
    }
 
52
}