File: 03-idiot.t

package info (click to toggle)
libmoosex-types-common-perl 0.001008-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 176 kB
  • sloc: perl: 1,716; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 712 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

use Test::More;

# Test for a warning when you make the stupid mistake I make all the time
# of saying use MooseX::Types::Common qw/NonEmptySimpleStr/;

BEGIN {
    eval { require Capture::Tiny }
        or plan skip_all => 'Capture::Tiny needed for these tests';
}

plan tests => 4;

use_ok 'MooseX::Types::Common';

my ($stdout, $stderr) = Capture::Tiny::capture(sub {
    MooseX::Types::Common->import;
});
is $stderr, '', 'No warning if nothing imported';

($stdout, $stderr) = Capture::Tiny::capture(sub {
    MooseX::Types::Common->import('NonEmptySimpleStr');
});
like $stderr, qr/Did you mean/, 'Got warning';
like $stderr, qr/NonEmptySimpleStr/, 'Warning mentions bad type';