~ubuntu-branches/ubuntu/precise/rakudo/precise

« back to all changes in this revision

Viewing changes to t/01-sanity/07-end-blocks.t

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-10-04 14:31:57 UTC
  • Revision ID: james.westby@ubuntu.com-20091004143157-ubq3wu0grk0f1e6a
Tags: upstream-0.1~2009.09
ImportĀ upstreamĀ versionĀ 0.1~2009.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use v6;
 
2
 
 
3
say "1..2";
 
4
 
 
5
#
 
6
# $was_in_second_end_block is a package variable, not a lexical one, per S04:
 
7
#
 
8
# Some closures produce C<Code> objects at compile time that cannot be
 
9
# cloned, because they're not attached to any runtime code that can
 
10
# actually clone them.  C<BEGIN>, C<CHECK>, C<INIT>, and C<END> blocks
 
11
# fall into this category...  It's only safe to refer to package
 
12
# variables and file-scoped lexicals from such a routine.
 
13
#
 
14
 
 
15
our $Main::was_in_second_end_block = 0;
 
16
 
 
17
END {
 
18
    if $Main::was_in_second_end_block {
 
19
        say "ok 2";
 
20
    } else {
 
21
        say "not ok 2";
 
22
    }
 
23
}
 
24
 
 
25
END {
 
26
    $Main::was_in_second_end_block = 1;
 
27
    say "ok 1";
 
28
}