Permalink
Browse files

pod and tests

  • Loading branch information...
1 parent 3aab88f commit 9c3a222f36e13a470f17bf429322d61957a60b84 @kawanet committed Apr 24, 2012
View
23 MANIFEST
@@ -0,0 +1,23 @@
+MANIFEST
+META.yml
+Makefile.PL
+README
+lib/Config/Pico.pm
+t/00_compile.t
+t/01_basic.t
+t/02_pico.t
+t/03_strict.t
+t/04_notfound.t
+t/config/array.pl
+t/config/arrayref.pl
+t/config/hashref.pl
+t/config/nostrict.pl
+t/config/one.pl
+t/config/plusarray.pl
+t/config/plusarrayref.pl
+t/config/plushashref.pl
+t/config/string.pl
+t/config/two.pl
+t/config/undef.pl
+t/config/usestrict.pl
+t/config/zero.pl
View
21 META.yml
@@ -0,0 +1,21 @@
+--- #YAML:1.0
+name: Config-Pico
+version: 0.01
+abstract: Perl Interpretative COnfiguration: do "config.pl"
+author:
+ - Yusuke Kawasaki
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 6.55
+build_requires:
+ Test::More: 0
+requires: {}
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.56
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
View
17 t/01_basic.t
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+BEGIN { use_ok 'Config::Pico' }
+
+my $a = do "t/config/string.pl";
+is($a, 'foobar', 'do');
+
+my $b = pico "t/config/string.pl";
+is($b, 'foobar', 'do');
+
+my $c = pico "t/config" => "string.pl";
+is($c, 'foobar', 'do');
+
+my $d = pico("t/config", "string.pl");
+is($d, 'foobar', 'do');
View
47 t/02_pico.t
@@ -0,0 +1,47 @@
+use strict;
+use warnings;
+use Test::More tests => 19;
+
+BEGIN { use_ok 'Config::Pico' }
+
+my $dir = 't/config';
+
+my $string = pico($dir, "string.pl");
+is($string, 'foobar', 'string');
+
+my $one = pico($dir, "one.pl");
+is($one, '1', 'one');
+
+my $two = pico($dir, "two.pl");
+is($two, '2', 'two');
+
+my $zero = pico($dir, "zero.pl");
+is($zero, '0', 'zero');
+
+my $undef = pico($dir, "undef.pl");
+ok(! defined $undef, 'undef');
+
+my @array = pico($dir, "array.pl");
+is($array[0], 'foo', 'array-0');
+is($array[1], 'bar', 'array-1');
+
+my @plusarray = pico($dir, "plusarray.pl");
+is($plusarray[0], 'foo', 'plusarray-0');
+is($plusarray[1], 'bar', 'plusarray-1');
+
+my $arrayref = pico($dir, "arrayref.pl");
+ok(ref $arrayref, 'arrayref');
+is($arrayref->[0], 'foo', 'arrayref-0');
+is($arrayref->[1], 'bar', 'arrayref-1');
+
+my $plusarrayref = pico($dir, "plusarrayref.pl");
+is($plusarrayref->[0], 'foo', 'plusarrayref-0');
+is($plusarrayref->[1], 'bar', 'plusarrayref-1');
+
+my $hashref = pico($dir, "hashref.pl");
+ok(ref $hashref, 'hashref');
+is($hashref->{foo}, 'bar', 'hashref-foo');
+
+my $plushashref = pico($dir, "plushashref.pl");
+ok(ref $plushashref, 'plushashref');
+is($plushashref->{foo}, 'bar', 'plushashref-foo');
View
24 t/03_strict.t
@@ -0,0 +1,24 @@
+use strict;
+use Test::More tests => 4;
+
+BEGIN { use_ok 'Config::Pico' }
+
+my @conf;
+
+eval {
+ @conf = do "t/config/usestrict.pl";
+};
+
+ok(! $@, "do() doesn't raise error");
+
+eval {
+ @conf = pico "t/config/usestrict.pl";
+};
+
+ok($@, "pico() raises error");
+
+eval {
+ @conf = pico "t/config/nostrict.pl";
+};
+
+ok(! $@, "pico() doesn't raise error without 'use strict'");
View
18 t/04_notfound.t
@@ -0,0 +1,18 @@
+use strict;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Config::Pico' }
+
+my @conf;
+
+eval {
+ @conf = do "config/notfound.pl";
+};
+
+ok(! $@, "do() doesn't raise error");
+
+eval {
+ @conf = pico "config/notfound.pl";
+};
+
+ok($@, "pico() raises error");
View
1 t/config/array.pl
@@ -0,0 +1 @@
+('foo', 'bar');
View
1 t/config/arrayref.pl
@@ -0,0 +1 @@
+['foo', 'bar'];
View
1 t/config/hashref.pl
@@ -0,0 +1 @@
+{ foo => 'bar' };
View
4 t/config/nostrict.pl
@@ -0,0 +1,4 @@
+no strict;
+no warnings;
+
+$foo = $bar;
View
1 t/config/one.pl
@@ -0,0 +1 @@
+1;
View
1 t/config/plusarray.pl
@@ -0,0 +1 @@
++('foo', 'bar');
View
1 t/config/plusarrayref.pl
@@ -0,0 +1 @@
++['foo', 'bar'];
View
1 t/config/plushashref.pl
@@ -0,0 +1 @@
++{ foo => 'bar' };
View
1 t/config/string.pl
@@ -0,0 +1 @@
+'foobar';
View
1 t/config/two.pl
@@ -0,0 +1 @@
+2;
View
1 t/config/undef.pl
@@ -0,0 +1 @@
+undef;
View
3 t/config/usestrict.pl
@@ -0,0 +1,3 @@
+use strict;
+use warnings;
+$foo = $bar;
View
1 t/config/zero.pl
@@ -0,0 +1 @@
+0;

0 comments on commit 9c3a222

Please sign in to comment.