Changelogging
[gitmo/Mouse.git] / t / 600_todo_tests / 008_replacing_super_methods.t
1 #!/usr/bin/env perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5 use strict;
6 use warnings;
7 use Test::More;
8
9 my ($super_called, $sub_called, $new_super_called) = (0, 0, 0);
10 {
11     package Foo;
12     use Mouse;
13
14     sub foo { $super_called++ }
15 }
16
17 {
18     package Foo::Sub;
19     use Mouse;
20     extends 'Foo';
21
22     override foo => sub {
23         $sub_called++;
24         super();
25     };
26 }
27
28 Foo::Sub->new->foo;
29 is($super_called, 1, "super called");
30 is($new_super_called, 0, "new super not called");
31 is($sub_called, 1, "sub called");
32
33 ($super_called, $sub_called, $new_super_called) = (0, 0, 0);
34
35 Foo->meta->add_method(foo => sub {
36     $new_super_called++;
37 });
38
39 Foo::Sub->new->foo;
40 { local $TODO = "super doesn't get replaced";
41 is($super_called, 0, "super not called");
42 is($new_super_called, 1, "new super called");
43 }
44 is($sub_called, 1, "sub called");
45
46 done_testing;