File: 03create.t

package info (click to toggle)
libfeature-compat-class-perl 0.07-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 188 kB
  • sloc: perl: 434; makefile: 2; sh: 1
file content (31 lines) | stat: -rw-r--r-- 504 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use v5.14;
use warnings;

use Test::More;

use Feature::Compat::Class;

{
   my @called;
   my $class_in_ADJUST;

   class Test1 {
      ADJUST {
         push @called, "ADJUST-1";
      }

      ADJUST {
         push @called, "ADJUST-2";
         $class_in_ADJUST = __CLASS__;
      }
   }

   Test1->new();
   is_deeply( \@called, [qw( ADJUST-1 ADJUST-2 )], 'ADJUST blocks invoked in sequence' );

   is( $class_in_ADJUST, "Test1", '__CLASS__ during ADJUST block' );
}

done_testing;