File: valid-config.t

package info (click to toggle)
libsub-exporter-perl 0.990-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: perl: 2,344; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 1,296 bytes parent folder | download | duplicates (8)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!perl -T
use strict;
use warnings;

=head1 TEST PURPOSE

These tests make sure that invalid configurations passed to
setup/build_exporter throw exceptions.

=cut

use Test::More tests => 6;

BEGIN { use_ok('Sub::Exporter'); }

eval {
  Sub::Exporter::build_exporter({
    exports    => [ qw(foo) ],
    collectors => [ qw(foo) ],
  })
};

like($@, qr/used in both/, "can't use one name in exports and collectors");

eval {
  Sub::Exporter::build_exporter({
    collections => [ qw(foo) ], # This one gets me all the time.  Live & learn.
  })
};

like($@, qr/unknown options/, "unknown options raise an exception");

eval {
  Sub::Exporter::setup_exporter({
    into       => 'Your::Face',
    into_level => 5,
  })
};

like(
  $@,
  qr/may not both/,
  "into and into_level are mutually exclusive (in setup_exporter)"
);

eval { 
  Sub::Exporter::build_exporter({})->(
    Class => {
      into       => 'Your::Face',
      into_level => 1
    }
  );
};

like(
  $@,
  qr/may not both/,
  "into and into_level are mutually exclusive (in exporter)"
);

eval {
  Sub::Exporter::build_exporter({
    into       => "This::Doesnt::Matter",
    into_level => 0,
  })
};

like(
  $@,
  qr(^into and into_level may not both be supplied to exporter),
  "can't use one name in exports and collectors"
);