4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
5 use MBTest tests => 13;
7 use_ok 'Module::Build';
8 ensure_blib('Module::Build');
10 my $tmp = MBTest->tmpdir;
13 my $dist = DistGen->new( dir => $tmp );
19 ###################################
20 $dist->change_file( 'Build.PL', <<"---" );
22 my \$build = Module::Build->new(
23 module_name => @{[$dist->name]},
26 \$build->create_build_script;
27 \$build->notes(foo => 'bar');
32 my $mb = Module::Build->new_from_context;
34 is $mb->notes('foo'), 'bar';
36 # Try setting & checking a new value
37 $mb->notes(argh => 'new');
38 is $mb->notes('argh'), 'new';
40 # Change existing value
41 $mb->notes(foo => 'foo');
42 is $mb->notes('foo'), 'foo';
44 # Change back so we can run this test again successfully
45 $mb->notes(foo => 'bar');
46 is $mb->notes('foo'), 'bar';
48 # Check undef vs. 0 vs ''
49 foreach my $val (undef, 0, '') {
50 $mb->notes(null => $val);
51 is $mb->notes('null'), $val;
55 ###################################
56 # Make sure notes set before create_build_script() get preserved
57 $mb = Module::Build->new(module_name => $dist->name);
59 $mb->notes(foo => 'bar');
60 is $mb->notes('foo'), 'bar';
62 $mb->create_build_script;
64 $mb = Module::Build->resume;
66 is $mb->notes('foo'), 'bar';