Remove unused Module::Build tests
[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';
5use MBTest tests => 11;
6
7use Cwd ();
8my $cwd = Cwd::cwd;
9my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' );
10
11use DistGen;
12my $dist = DistGen->new( dir => $tmp );
13$dist->regen;
14
15chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
16
17
18use Module::Build;
19
20###################################
21$dist->change_file( 'Build.PL', <<"---" );
22use Module::Build;
23my \$build = Module::Build->new(
24 module_name => @{[$dist->name]},
25 license => 'perl'
26);
27\$build->create_build_script;
28\$build->notes(foo => 'bar');
29---
30
31$dist->regen;
32
33my $mb = Module::Build->new_from_context;
34
35is $mb->notes('foo'), 'bar';
36
37# Try setting & checking a new value
38$mb->notes(argh => 'new');
39is $mb->notes('argh'), 'new';
40
41# Change existing value
42$mb->notes(foo => 'foo');
43is $mb->notes('foo'), 'foo';
44
45# Change back so we can run this test again successfully
46$mb->notes(foo => 'bar');
47is $mb->notes('foo'), 'bar';
48
49# Check undef vs. 0 vs ''
50foreach my $val (undef, 0, '') {
51 $mb->notes(null => $val);
52 is $mb->notes('null'), $val;
53}
54
55
56###################################
57# Make sure notes set before create_build_script() get preserved
58$mb = Module::Build->new(module_name => $dist->name);
59ok $mb;
60$mb->notes(foo => 'bar');
61is $mb->notes('foo'), 'bar';
62
63$mb->create_build_script;
64
65$mb = Module::Build->resume;
66ok $mb;
67is $mb->notes('foo'), 'bar';
68
69
70# cleanup
71chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
72$dist->remove;
73
74use File::Path;
75rmtree( $tmp );