Example #1
0
 def test_unwind_protect_loop(self):
   from util import a, i
   eq_(eval(let([(i,3)], 
                block(a, assign(i, sub(i, 1)), 
                         if_(eq(i, 0), 
                           exit_block(a, 1),
                           unwind_protect(continue_block(a), prin(i)))), i)), 0)
Example #2
0
 def test_unwind_protect_loop(self):
     from util import a, i
     eq_(
         eval(
             let([(i, 3)],
                 block(
                     a, assign(i, sub(i, 1)),
                     if_(eq(i, 0), exit_block(a, 1),
                         unwind_protect(continue_block(a), prin(i)))), i)),
         0)
Example #3
0
 def test_unwind_protect2(self):
     foo = Var('foo')
     eq_(
         eval(
             block(foo, unwind_protect(exit_block(foo, 1), prin(2),
                                       prin(3)))), 1)
Example #4
0
 def test_unwind_protect2(self):
   foo = Var('foo')
   eq_(eval(block(foo, unwind_protect(exit_block(foo, 1), 
                           prin(2), prin(3)))), 1)