Add ExtUtils::Miniperl to the list of core modules for all versions >= 5.00504
[p5sagit/p5-mst-13.2.git] / lib / Module / Build / t / notes.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
5 use MBTest tests => 13;
6
7 use_ok 'Module::Build';
8 ensure_blib('Module::Build');
9
10 my $tmp = MBTest->tmpdir;
11
12 use DistGen;
13 my $dist = DistGen->new( dir => $tmp );
14 $dist->regen;
15
16 $dist->chdir_in;
17
18
19 ###################################
20 $dist->change_file( 'Build.PL', <<"---" );
21 use Module::Build;
22 my \$build = Module::Build->new(
23   module_name => @{[$dist->name]},
24   license     => 'perl'
25 );
26 \$build->create_build_script;
27 \$build->notes(foo => 'bar');
28 ---
29
30 $dist->regen;
31
32 my $mb = Module::Build->new_from_context;
33
34 is $mb->notes('foo'), 'bar';
35
36 # Try setting & checking a new value
37 $mb->notes(argh => 'new');
38 is $mb->notes('argh'), 'new';
39
40 # Change existing value
41 $mb->notes(foo => 'foo');
42 is $mb->notes('foo'), 'foo';
43
44 # Change back so we can run this test again successfully
45 $mb->notes(foo => 'bar');
46 is $mb->notes('foo'), 'bar';
47
48 # Check undef vs. 0 vs ''
49 foreach my $val (undef, 0, '') {
50   $mb->notes(null => $val);
51   is $mb->notes('null'), $val;
52 }
53
54
55 ###################################
56 # Make sure notes set before create_build_script() get preserved
57 $mb = Module::Build->new(module_name => $dist->name);
58 ok $mb;
59 $mb->notes(foo => 'bar');
60 is $mb->notes('foo'), 'bar';
61
62 $mb->create_build_script;
63
64 $mb = Module::Build->resume;
65 ok $mb;
66 is $mb->notes('foo'), 'bar';
67
68
69 # cleanup
70 $dist->remove;