From c849b5fa1b231806e341eefbbcc39b8ab3c9523d Mon Sep 17 00:00:00 2001 From: Ricardo SIGNES Date: Mon, 13 Aug 2007 21:09:50 -0400 Subject: [PATCH] tidy up test code formatting --- t/pod.t | 3 +-- t/reader.t | 72 +++++++++++++++++++++++++++--------------------------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/t/pod.t b/t/pod.t index abb1ae4..008a523 100644 --- a/t/pod.t +++ b/t/pod.t @@ -3,6 +3,5 @@ use strict; use Test::More; eval "use Test::Pod 1.14"; -plan skip_all => "Test::Pod 1.14 required for testing POD" - if $@; +plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); diff --git a/t/reader.t b/t/reader.t index 3b6db3a..067a62f 100644 --- a/t/reader.t +++ b/t/reader.t @@ -15,21 +15,21 @@ isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_file"); # Check the structure of the config my $expected = { - '_' => { - root => 'something', - }, - section => { - one => 'two', - Foo => 'Bar', - this => 'Your Mother!', - blank => '', - moo => 'kooh', - }, - 'Section Two' => { - 'something else' => 'blah', - 'remove' => 'whitespace', - }, - }; + '_' => { + root => 'something', + }, + section => { + one => 'two', + Foo => 'Bar', + this => 'Your Mother!', + blank => '', + moo => 'kooh', + }, + 'Section Two' => { + 'something else' => 'blah', + 'remove' => 'whitespace', + }, +}; is_deeply($hashref, $expected, 'Config structure matches expected'); @@ -37,13 +37,13 @@ is_deeply($hashref, $expected, 'Config structure matches expected'); my $Trivial = {}; $Trivial->{_} = { root1 => 'root2' }; $Trivial->{section} = { - foo => 'bar', - this => 'that', - blank => '', - }; + foo => 'bar', + this => 'that', + blank => '', +}; $Trivial->{section2} = { - 'this little piggy' => 'went to market' - }; + 'this little piggy' => 'went to market' +}; my $string = <read_string( $string ); - isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_string"); + my $hashref = Config::INI::Reader->read_string( $string ); + isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_string"); - is_deeply( $hashref, $Trivial, '->read_string returns expected value' ); + is_deeply( $hashref, $Trivial, '->read_string returns expected value' ); } { # Test read_handle - my $fh = IO::File->new('examples/simple.ini', 'r'); - my $data = do { local $/ = undef; <$fh> }; - - is_deeply( - Config::INI::Reader->new->read_handle( IO::String->new($data) ), - $expected, - '->read_handle returns expected value' - ); + my $fh = IO::File->new('examples/simple.ini', 'r'); + my $data = do { local $/ = undef; <$fh> }; + + is_deeply( + Config::INI::Reader->new->read_handle( IO::String->new($data) ), + $expected, + '->read_handle returns expected value' + ); } ##################################################################### # Bugs that happened we don't want to happen again { -# Reading in an empty file, or a defined but zero length string, should yield -# a valid, but empty, object. - my $empty = Config::INI::Reader->read_string(''); - is_deeply($empty, {}, "an empty string gets an empty hashref"); + # Reading in an empty file, or a defined but zero length string, should yield + # a valid, but empty, object. + my $empty = Config::INI::Reader->read_string(''); + is_deeply($empty, {}, "an empty string gets an empty hashref"); }