File: check_sugar.t

package info (click to toggle)
libtest-moose-more-perl 0.024-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 312 kB
  • ctags: 25
  • sloc: perl: 303; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,537 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use strict;
use warnings;

{
    package TestClass;
    use Moose;
}
{
    package TestClass::NotCleaned;
    use Moose;
    no Moose;
}

use Test::Builder::Tester; # tests => 1;
use Test::More;
use Test::Moose::More;

# not ok 1 - TestRole can has
# not ok 2 - TestRole can around
# not ok 3 - TestRole can augment
# not ok 4 - TestRole can inner
# not ok 5 - TestRole can before
# not ok 6 - TestRole can after
# not ok 7 - TestRole can blessed
# not ok 8 - TestRole can confess

# check for sugar in a class that still has it
my $i;
do { $i++; test_out "ok $i - TestClass can $_" }
    for Test::Moose::More::known_sugar();
check_sugar_ok 'TestClass';
test_test 'check_sugar_ok works correctly';

# check for sugar in a class that has none
$i = 0;
do { $i++; test_out "not ok $i - TestClass::NotCleaned can $_"; test_fail(2) }
    for Test::Moose::More::known_sugar();
check_sugar_ok 'TestClass::NotCleaned';
test_test 'check_sugar_ok works correctly on classes without sugar';

# check for no sugar in a class that still has it
$i = 0;
do { $i++; test_out "not ok $i - TestClass cannot $_"; test_fail(2) }
    for Test::Moose::More::known_sugar();
check_sugar_removed_ok 'TestClass';
test_test 'check_sugar_removed_ok works correctly with sugar';

# check for no sugar in a class that has none
$i = 0;
do { $i++; test_out "ok $i - TestClass::NotCleaned cannot $_" }
    for Test::Moose::More::known_sugar();
check_sugar_removed_ok 'TestClass::NotCleaned';
test_test 'check_sugar_removed_ok works correctly w/o sugar';

done_testing;