root/t/unspecced/sub_application.t

Revision 21719, 1.1 kB (checked in by lwall, 5 months ago)

[STD] detect obsolete use of =cut
[t/*.t] delete obsolete uses of =cut

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1use v6;
2
3use Test;
4
5plan 4;
6
7=begin pod
8
9    $foo(42);  # is sugar for
10    $foo.postcircumfix:<( )>(42);
11
12=end pod
13
14# Example: Make $foo() a noop.
15{
16    my $foo = 42;
17    dies_ok { $foo() }, "basic sanity";
18
19    eval '$foo does role {
20        method postcircumfix:<( )> {}
21    }';
22    lives_ok { $foo() }, "overriding postcircumfix:<( )> (1)", :todo<feature>;
23}
24
25# Example: Make $foo() modify another variable.
26{
27    my $foo = 42;
28    my $bar = 23;
29
30    eval '$foo does role {
31        method postcircumfix:<( )> {
32            $bar++;
33        }
34    }';
35    try { $foo() };
36    is $bar, 24, "overriding postcircumfix:<( )> (2)", :todo<feature>;
37}
38
39# .postcircumfix:<( )> is called even when you don't actually use ()s to
40# call, as
41#   foo;    # is merely sugar for
42#   foo();
43{
44    my $bar;
45    my sub foo {
46        # This body should never be called!
47        $bar = 23
48    };
49    eval '&foo does role {
50        method postcircumfix:<( )> {
51            $bar = 42;
52        }
53    }';
54
55    foo;
56    is $bar, 42,
57        ".postcircumfix:<( )> is called even when you don't actually use ()s to call",
58        :todo<feature>;
59}
Note: See TracBrowser for help on using the browser.