File: import.t

package info (click to toggle)
libdata-guid-perl 0.051-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 212 kB
  • sloc: perl: 427; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,178 bytes parent folder | download | duplicates (5)
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
#!perl

use strict;
use warnings;

use Test::More tests => 11;

BEGIN { use_ok('Data::GUID'); }

package Test::Data::GUID::BAD_EXPORT;

eval { Data::GUID->import('strong_crypto'); };
main::like($@, qr/"strong_crypto" is not exported/, "croak on bad import arg");

package Test::Data::GUID::ALL;

BEGIN { Data::GUID->import(':all'); }

for my $sub (qw(guid_string guid_hex guid_base64)) {
  main::isa_ok(__PACKAGE__->can($sub), 'CODE', "the $sub sub imported (:all)");
  # Why doesn't the following line work?  Replacing __PACKAGE__ doesn't help.
  # main::can_ok(__PACKAGE__, $sub, "$sub properly imported");
}

package Test::Data::GUID::ALL_LIST;

BEGIN { Data::GUID->import(qw(guid_string guid_hex guid_base64)); }

for my $sub (qw(guid_string guid_hex guid_base64)) {
  main::isa_ok(__PACKAGE__->can($sub), 'CODE', "the $sub sub imported (named)");
}

package Test::Data::GUID::GUID_STRING;

BEGIN { Data::GUID->import(qw(guid_string)); }

for my $sub (qw(guid_string)) {
  main::isa_ok(__PACKAGE__->can($sub), 'CODE', "the $sub sub imported (alone)");
}

for my $sub (qw(guid_hex guid_base64)) {
  main::is(__PACKAGE__->can($sub), undef, "the $sub sub was not imported");
}