Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

pod and tests

  • Loading branch information...
commit 9c3a222f36e13a470f17bf429322d61957a60b84 1 parent 3aab88f
Yusuke Kawasaki authored
23 MANIFEST
... ... @@ -0,0 +1,23 @@
  1 +MANIFEST
  2 +META.yml
  3 +Makefile.PL
  4 +README
  5 +lib/Config/Pico.pm
  6 +t/00_compile.t
  7 +t/01_basic.t
  8 +t/02_pico.t
  9 +t/03_strict.t
  10 +t/04_notfound.t
  11 +t/config/array.pl
  12 +t/config/arrayref.pl
  13 +t/config/hashref.pl
  14 +t/config/nostrict.pl
  15 +t/config/one.pl
  16 +t/config/plusarray.pl
  17 +t/config/plusarrayref.pl
  18 +t/config/plushashref.pl
  19 +t/config/string.pl
  20 +t/config/two.pl
  21 +t/config/undef.pl
  22 +t/config/usestrict.pl
  23 +t/config/zero.pl
21 META.yml
... ... @@ -0,0 +1,21 @@
  1 +--- #YAML:1.0
  2 +name: Config-Pico
  3 +version: 0.01
  4 +abstract: Perl Interpretative COnfiguration: do "config.pl"
  5 +author:
  6 + - Yusuke Kawasaki
  7 +license: perl
  8 +distribution_type: module
  9 +configure_requires:
  10 + ExtUtils::MakeMaker: 6.55
  11 +build_requires:
  12 + Test::More: 0
  13 +requires: {}
  14 +no_index:
  15 + directory:
  16 + - t
  17 + - inc
  18 +generated_by: ExtUtils::MakeMaker version 6.56
  19 +meta-spec:
  20 + url: http://module-build.sourceforge.net/META-spec-v1.4.html
  21 + version: 1.4
17 t/01_basic.t
... ... @@ -0,0 +1,17 @@
  1 +use strict;
  2 +use warnings;
  3 +use Test::More tests => 5;
  4 +
  5 +BEGIN { use_ok 'Config::Pico' }
  6 +
  7 +my $a = do "t/config/string.pl";
  8 +is($a, 'foobar', 'do');
  9 +
  10 +my $b = pico "t/config/string.pl";
  11 +is($b, 'foobar', 'do');
  12 +
  13 +my $c = pico "t/config" => "string.pl";
  14 +is($c, 'foobar', 'do');
  15 +
  16 +my $d = pico("t/config", "string.pl");
  17 +is($d, 'foobar', 'do');
47 t/02_pico.t
... ... @@ -0,0 +1,47 @@
  1 +use strict;
  2 +use warnings;
  3 +use Test::More tests => 19;
  4 +
  5 +BEGIN { use_ok 'Config::Pico' }
  6 +
  7 +my $dir = 't/config';
  8 +
  9 +my $string = pico($dir, "string.pl");
  10 +is($string, 'foobar', 'string');
  11 +
  12 +my $one = pico($dir, "one.pl");
  13 +is($one, '1', 'one');
  14 +
  15 +my $two = pico($dir, "two.pl");
  16 +is($two, '2', 'two');
  17 +
  18 +my $zero = pico($dir, "zero.pl");
  19 +is($zero, '0', 'zero');
  20 +
  21 +my $undef = pico($dir, "undef.pl");
  22 +ok(! defined $undef, 'undef');
  23 +
  24 +my @array = pico($dir, "array.pl");
  25 +is($array[0], 'foo', 'array-0');
  26 +is($array[1], 'bar', 'array-1');
  27 +
  28 +my @plusarray = pico($dir, "plusarray.pl");
  29 +is($plusarray[0], 'foo', 'plusarray-0');
  30 +is($plusarray[1], 'bar', 'plusarray-1');
  31 +
  32 +my $arrayref = pico($dir, "arrayref.pl");
  33 +ok(ref $arrayref, 'arrayref');
  34 +is($arrayref->[0], 'foo', 'arrayref-0');
  35 +is($arrayref->[1], 'bar', 'arrayref-1');
  36 +
  37 +my $plusarrayref = pico($dir, "plusarrayref.pl");
  38 +is($plusarrayref->[0], 'foo', 'plusarrayref-0');
  39 +is($plusarrayref->[1], 'bar', 'plusarrayref-1');
  40 +
  41 +my $hashref = pico($dir, "hashref.pl");
  42 +ok(ref $hashref, 'hashref');
  43 +is($hashref->{foo}, 'bar', 'hashref-foo');
  44 +
  45 +my $plushashref = pico($dir, "plushashref.pl");
  46 +ok(ref $plushashref, 'plushashref');
  47 +is($plushashref->{foo}, 'bar', 'plushashref-foo');
24 t/03_strict.t
... ... @@ -0,0 +1,24 @@
  1 +use strict;
  2 +use Test::More tests => 4;
  3 +
  4 +BEGIN { use_ok 'Config::Pico' }
  5 +
  6 +my @conf;
  7 +
  8 +eval {
  9 + @conf = do "t/config/usestrict.pl";
  10 +};
  11 +
  12 +ok(! $@, "do() doesn't raise error");
  13 +
  14 +eval {
  15 + @conf = pico "t/config/usestrict.pl";
  16 +};
  17 +
  18 +ok($@, "pico() raises error");
  19 +
  20 +eval {
  21 + @conf = pico "t/config/nostrict.pl";
  22 +};
  23 +
  24 +ok(! $@, "pico() doesn't raise error without 'use strict'");
18 t/04_notfound.t
... ... @@ -0,0 +1,18 @@
  1 +use strict;
  2 +use Test::More tests => 3;
  3 +
  4 +BEGIN { use_ok 'Config::Pico' }
  5 +
  6 +my @conf;
  7 +
  8 +eval {
  9 + @conf = do "config/notfound.pl";
  10 +};
  11 +
  12 +ok(! $@, "do() doesn't raise error");
  13 +
  14 +eval {
  15 + @conf = pico "config/notfound.pl";
  16 +};
  17 +
  18 +ok($@, "pico() raises error");
1  t/config/array.pl
... ... @@ -0,0 +1 @@
  1 +('foo', 'bar');
1  t/config/arrayref.pl
... ... @@ -0,0 +1 @@
  1 +['foo', 'bar'];
1  t/config/hashref.pl
... ... @@ -0,0 +1 @@
  1 +{ foo => 'bar' };
4 t/config/nostrict.pl
... ... @@ -0,0 +1,4 @@
  1 +no strict;
  2 +no warnings;
  3 +
  4 +$foo = $bar;
1  t/config/one.pl
... ... @@ -0,0 +1 @@
  1 +1;
1  t/config/plusarray.pl
... ... @@ -0,0 +1 @@
  1 ++('foo', 'bar');
1  t/config/plusarrayref.pl
... ... @@ -0,0 +1 @@
  1 ++['foo', 'bar'];
1  t/config/plushashref.pl
... ... @@ -0,0 +1 @@
  1 ++{ foo => 'bar' };
1  t/config/string.pl
... ... @@ -0,0 +1 @@
  1 +'foobar';
1  t/config/two.pl
... ... @@ -0,0 +1 @@
  1 +2;
1  t/config/undef.pl
... ... @@ -0,0 +1 @@
  1 +undef;
3  t/config/usestrict.pl
... ... @@ -0,0 +1,3 @@
  1 +use strict;
  2 +use warnings;
  3 +$foo = $bar;
1  t/config/zero.pl
... ... @@ -0,0 +1 @@
  1 +0;

0 comments on commit 9c3a222

Please sign in to comment.
Something went wrong with that request. Please try again.