1 |
#!perl -w |
2 |
use strict; |
3 |
use Module::CoreList; |
4 |
use Test::More tests => 33; |
5 |
|
6 |
BEGIN { require_ok('Module::CoreList'); } |
7 |
|
8 |
ok(!Module::CoreList::is_core('Module::Path'), 'Module::Path has never been in core'); |
9 |
ok(!Module::CoreList::is_core('Module::Path', undef, '5.016003'), 'Module::Path has never been in core'); |
10 |
ok(!Module::CoreList::is_core('Module::Path', undef), 'Module::Path has never been in core'); |
11 |
|
12 |
# List::Util::PP was added in 5.010001 and removed in 5.017001 |
13 |
ok(!Module::CoreList::is_core('List::Util::PP', undef, '5.002'), 'List::Util::PP was added in 5.10.1 so not in core in 5.002'); |
14 |
ok(Module::CoreList::is_core('List::Util::PP', undef, '5.016003'), 'List::Util::PP was in core in 5.16.3'); |
15 |
ok(!Module::CoreList::is_core('List::Util::PP', undef, '5.018001'), 'List::Util::PP was removed in 5.17.1 so not in core in 5.18.1'); |
16 |
|
17 |
# Carp has always been a core module |
18 |
ok(Module::CoreList::is_core('Carp', undef, '5'), 'Carp was a core module in first release of perl 5'); |
19 |
ok(Module::CoreList::is_core('Carp', undef, '5.019004'), 'Carp was still a core module in 5.19.4'); |
20 |
ok(Module::CoreList::is_core('Carp'), "Carp should be a core module whatever version of perl you're running"); |
21 |
|
22 |
ok(Module::CoreList::is_core('attributes', undef, '5.00503') == 0, "attributes weren't in 5.00503"); |
23 |
ok(Module::CoreList::is_core('attributes', undef, '5.006001') == 1, "attributes were in 5.6.1"); |
24 |
ok(Module::CoreList::is_core('Pod::Plainer', undef, '5.012001') == 1, "Pod::Plainer was core in 5.12.1"); |
25 |
ok(Module::CoreList::is_core('Pod::Plainer', undef, '5.016003') == 0, "Pod::Plainer was removed in 5.13.1"); |
26 |
|
27 |
# history of module 'encoding' in core |
28 |
# version 1.00 included in 5.007003 |
29 |
# version 1.35 included in 5.008 |
30 |
# version 1.47 included in 5.008001 |
31 |
# version 1.48 included in 5.008003 |
32 |
# version 2.00 included in 5.008005 |
33 |
# version 2.01 included in 5.008006 |
34 |
# version 2.02 included in 5.008008 |
35 |
# version 2.6_01 included in 5.008009 |
36 |
# version 2.04 included in 5.009004 |
37 |
# version 2.06 included in 5.009005 |
38 |
# version 2.6_01 included in 5.010001 |
39 |
# version 2.12 included in 5.019001 |
40 |
|
41 |
ok(!Module::CoreList::is_core('encoding', undef, '5'), "encoding wasn't in core in first release of perl 5"); |
42 |
ok(!Module::CoreList::is_core('encoding', '1.00', '5'), "encoding 1.00 wasn't in core in first release of perl 5"); |
43 |
ok(!Module::CoreList::is_core('encoding', '1.35', '5.007003'), "encoding 1.35 wasn't yet in core in perl 5.007003"); |
44 |
ok(Module::CoreList::is_core('encoding', '1.35', '5.008'), "encoding 1.35 was first included in perl 5.008"); |
45 |
ok(Module::CoreList::is_core('encoding', '1.35', '5.009004'), "encoding 2.04 (>1.35) was included in 5.009004"); |
46 |
ok(Module::CoreList::is_core('encoding', '2.01', '5.008007'), "encoding 2.01 was first in core in perl 5.008006, so was core in 5.8.7"); |
47 |
ok(Module::CoreList->is_core('encoding', '2.01', '5.008007'), "encoding 2.01 was first in core in perl 5.008006, so was core in 5.8.7"); |
48 |
|
49 |
# Module::CoreList (2.17) was first included in 5.008009 |
50 |
ok(!Module::CoreList::is_core('Module::CoreList', undef, '5.007003'), "Module::CoreList wasn't core in perl 5.7.3"); |
51 |
ok(!Module::CoreList->is_core('Module::CoreList', undef, '5.007003'), "Module::CoreList wasn't core in perl 5.7.3 (class method)"); |
52 |
|
53 |
# Test for situations where different branches on the perl |
54 |
# release tree had different versions of a module, and a naive |
55 |
# checking of perl release number will trip you up |
56 |
ok(Module::CoreList->is_core('Text::Soundex', '1.01', '5.008007'), "Text::Soundex 1.01 was first included in 5.007003"); |
57 |
ok(Module::CoreList->is_core('Text::Soundex', '3.03', '5.008009'), "Text::Soundex 3.03 was included in 5.008009"); |
58 |
ok(!Module::CoreList->is_core('Text::Soundex', '3.03', '5.009003'), "5.009003 still had Text::Soundex 1.01"); |
59 |
ok(Module::CoreList->is_core('Text::Soundex', '1.01', '5.009003'), "5.009003 still had Text::Soundex 1.01"); |
60 |
ok(!Module::CoreList->is_core('Text::Soundex', '3.03', '5.009005'), "5.009005 still had Text::Soundex 3.02"); |
61 |
ok(Module::CoreList->is_core('Text::Soundex', '3.02', '5.009005'), "5.009005 had Text::Soundex 3.02"); |
62 |
ok(Module::CoreList->is_core('Text::Soundex', '3.03', '5.01'), "5.01 had Text::Soundex 3.03"); |
63 |
|
64 |
# 5.002 was the first perl release where core modules had a version number |
65 |
ok(Module::CoreList->is_core('DB_File', '1.01', '5.002'), "DB_File 1.01 was included in 5.002"); |
66 |
ok(!Module::CoreList->is_core('DB_File', '1.03', '5.002'), "DB_File 1.03 wasn't included in 5.002"); |
67 |
ok(Module::CoreList->is_core('DB_File', '1.03', '5.00307'), "DB_File 1.03 was included in 5.00307"); |