From ecca64326f6b745787e2edd9951cc95263aa42f6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 11 Jul 2009 13:12:22 +0200 Subject: Moved test to t/ subdirectory, shortened Build.PL --- Build.PL | 1 - t/simplestore.t | 30 ++++++++++++++++++++++++++++++ test/simplestore.t | 30 ------------------------------ 3 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 t/simplestore.t delete mode 100755 test/simplestore.t diff --git a/Build.PL b/Build.PL index dcd6dae..b6cf0f4 100644 --- a/Build.PL +++ b/Build.PL @@ -5,6 +5,5 @@ use Module::Build; my $build = Module::Build->new( module_name => 'Simplestore', - test_files => 'test/simplestore.t', ); $build->create_build_script; diff --git a/t/simplestore.t b/t/simplestore.t new file mode 100644 index 0000000..3c35f83 --- /dev/null +++ b/t/simplestore.t @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Pod::Checker; +use Test::More tests => 8; +my $testfile = "/tmp/simplestore-test-$$"; + +my $hash; + +is(podchecker('lib/Simplestore.pm'), 0, "Valid POD"); + +BEGIN {use_ok('Simplestore')} +require_ok('Simplestore'); + +$hash = {foo => "bar\nbar"}; +ok(save($testfile, $hash), 'save hash 1'); +undef $hash; + +ok($hash = load($testfile), 'load hash 1'); +is($hash->{foo}, "bar\nbar", 'successful storage & load'); + +$hash = {dude => "dudette\nfoo"}; +$hash = load($testfile, $hash); +is($hash->{dude}, "dudette\nfoo", 'load: preserve hash keys'); + +$hash = {foo => "moose\nbaz"}; +$hash = load($testfile, $hash); +is($hash->{foo}, "bar\nbar", 'load: overwrite conflicting hash keys'); + +unlink($testfile); diff --git a/test/simplestore.t b/test/simplestore.t deleted file mode 100755 index 3c35f83..0000000 --- a/test/simplestore.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Pod::Checker; -use Test::More tests => 8; -my $testfile = "/tmp/simplestore-test-$$"; - -my $hash; - -is(podchecker('lib/Simplestore.pm'), 0, "Valid POD"); - -BEGIN {use_ok('Simplestore')} -require_ok('Simplestore'); - -$hash = {foo => "bar\nbar"}; -ok(save($testfile, $hash), 'save hash 1'); -undef $hash; - -ok($hash = load($testfile), 'load hash 1'); -is($hash->{foo}, "bar\nbar", 'successful storage & load'); - -$hash = {dude => "dudette\nfoo"}; -$hash = load($testfile, $hash); -is($hash->{dude}, "dudette\nfoo", 'load: preserve hash keys'); - -$hash = {foo => "moose\nbaz"}; -$hash = load($testfile, $hash); -is($hash->{foo}, "bar\nbar", 'load: overwrite conflicting hash keys'); - -unlink($testfile); -- cgit v1.2.3