4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
5 use MBTest tests => 11;
9 my $tmp = MBTest->tmpdir;
12 my $dist = DistGen->new( dir => $tmp );
15 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
20 ###################################
21 $dist->change_file( 'Build.PL', <<"---" );
23 my \$build = Module::Build->new(
24 module_name => @{[$dist->name]},
27 \$build->create_build_script;
28 \$build->notes(foo => 'bar');
33 my $mb = Module::Build->new_from_context;
35 is $mb->notes('foo'), 'bar';
37 # Try setting & checking a new value
38 $mb->notes(argh => 'new');
39 is $mb->notes('argh'), 'new';
41 # Change existing value
42 $mb->notes(foo => 'foo');
43 is $mb->notes('foo'), 'foo';
45 # Change back so we can run this test again successfully
46 $mb->notes(foo => 'bar');
47 is $mb->notes('foo'), 'bar';
49 # Check undef vs. 0 vs ''
50 foreach my $val (undef, 0, '') {
51 $mb->notes(null => $val);
52 is $mb->notes('null'), $val;
56 ###################################
57 # Make sure notes set before create_build_script() get preserved
58 $mb = Module::Build->new(module_name => $dist->name);
60 $mb->notes(foo => 'bar');
61 is $mb->notes('foo'), 'bar';
63 $mb->create_build_script;
65 $mb = Module::Build->resume;
67 is $mb->notes('foo'), 'bar';
71 chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";