~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to t/nqp/44-try-catch.t

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# Tests for try and catch
4
4
 
5
 
plan(8);
 
5
plan(9);
6
6
 
7
7
sub oops($msg = "oops!") { # throw an exception
8
8
    nqp::die($msg);
36
36
$ok := 1;
37
37
sub bar() {
38
38
    CATCH { $ok := 0; }
39
 
    return;
 
39
    return 1;
40
40
}
41
41
bar();
42
42
ok($ok, "CATCH blocks ignore control exceptions");
67
67
}
68
68
 
69
69
ok($ok == 16, "resuming from resumable exceptions works");
 
70
 
 
71
$ok := "";
 
72
{
 
73
  try {
 
74
    oops();
 
75
    CATCH {
 
76
      $ok := $_;
 
77
    }
 
78
  }
 
79
}
 
80
 
 
81
ok($ok eq "oops!", "combination of both try and CATCH");