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
CommitLineData
bb4e9162 1#!/usr/bin/perl -w
2
3use strict;
4use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
738349a8 5use MBTest tests => 13;
6
7use_ok 'Module::Build';
8ensure_blib('Module::Build');
bb4e9162 9
7a827510 10my $tmp = MBTest->tmpdir;
bb4e9162 11
12use DistGen;
13my $dist = DistGen->new( dir => $tmp );
14$dist->regen;
15
738349a8 16$dist->chdir_in;
bb4e9162 17
bb4e9162 18
19###################################
20$dist->change_file( 'Build.PL', <<"---" );
21use Module::Build;
22my \$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
32my $mb = Module::Build->new_from_context;
33
34is $mb->notes('foo'), 'bar';
35
36# Try setting & checking a new value
37$mb->notes(argh => 'new');
38is $mb->notes('argh'), 'new';
39
40# Change existing value
41$mb->notes(foo => 'foo');
42is $mb->notes('foo'), 'foo';
43
44# Change back so we can run this test again successfully
45$mb->notes(foo => 'bar');
46is $mb->notes('foo'), 'bar';
47
48# Check undef vs. 0 vs ''
49foreach 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);
58ok $mb;
59$mb->notes(foo => 'bar');
60is $mb->notes('foo'), 'bar';
61
62$mb->create_build_script;
63
64$mb = Module::Build->resume;
65ok $mb;
66is $mb->notes('foo'), 'bar';
67
68
69# cleanup
bb4e9162 70$dist->remove;