File: use-after-no.t

package info (click to toggle)
libmoo-perl 2.005005-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 840 kB
  • sloc: perl: 2,506; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 507 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
32
33
34
35
36
37
38
39
40
41
42
use strict;
use warnings;

use Test::More;

ok eval q{
  package Spoon;
  use Moo;

  has foo => ( is => 'ro' );

  no Moo;

  use Moo;

  has foo2 => ( is => 'ro' );

  no Moo;

  1;
}, "subs imported on 'use Moo;' after 'no Moo;'"
    or diag $@;

ok eval q{
  package Roller;
  use Moo::Role;

  has foo => ( is => 'ro' );

  no Moo::Role;

  use Moo::Role;

  has foo2 => ( is => 'ro' );

  no Moo::Role;

  1;
}, "subs imported on 'use Moo::Role;' after 'no Moo::Role;'"
    or diag $@;

done_testing;