1 /*This file is a part of Tourbillon compiler test suit.
 2   The automatic test of the "try...catch" construction.*/
 3 
 4 #lang transd
 5 
 6 mainModule : {
 7     check: "before try; before while; OK 10; OK 11; OK 12; fail; after try.",
 8     ss: StringStream(),
 9 
10     funcF: (lambda i Int()
11         (if (!= i 13)
12             (textout to ss "OK " i "; ")
13         else
14             (throw "fail; "))),
15 
16     func1: (lambda
17         (textout to ss "before try; ")
18         (try
19             (textout to ss "before while; ")
20             (with n 10
21                 (while (< n 15) (+= n 1)
22                     (funcF n)
23                 )
24             )
25             (textout to ss "after while; ")
26             (catch (textout to ss (str @ex)))
27         )
28         (textout to ss "after try.")
29         (textout (if (eq check (str ss)) "success" else "FAILED"))
30     ),
31     _start: (lambda (func1))
32 }