"Fossies" - the Fresh Open Source Software Archive

Member "Module-Build-0.4224/t/notes.t" (30 May 2017, 1286 Bytes) of package /linux/privat/Module-Build-0.4224.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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