File: 070_Trait_mod_perl_test.t

package info (click to toggle)
libclass-trait-perl 0.31-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 364 kB
  • ctags: 156
  • sloc: perl: 2,467; makefile: 46
file content (25 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 2;

BEGIN {
    unshift @INC => ( 't/test_lib', '/test_lib' );
}

# NOTE:

# This test proves that traits can work under mod_perl, if care is taken about
# how things are loaded. All traits should be imported from within your
# startup file, and then the Class::Trait->initialize() method should be
# called after all are loaded. This should result in the correct behavior.

my $warn;
local $SIG{__WARN__} = sub { $warn = shift };

eval "use BasicTrait;";

ok ! defined $warn, 'mod_perl should no longer warn on startup';
ok( BasicTrait->does("TSimple"), '.. BasicTrait is TSimple' );