Whitespace trim tests
[gitmo/MooseX-Storage.git] / t / 020_basic_yaml.t
index 794f883..4208d6b 100644 (file)
@@ -1,12 +1,16 @@
 #!/usr/bin/perl
-
+$|++;
 use strict;
 use warnings;
 
-use Test::More no_plan => 1;
-use Test::YAML::Valid;
+use Test::More;
 
 BEGIN {
+    eval "use Test::YAML::Valid";
+    plan skip_all => "Test::YAML::Valid is required for this test" if $@;
+    eval "use Best [[qw(YAML::Syck YAML)]]";
+    plan skip_all => "YAML or YAML::syck and Best are required for this test" if $@;
+    plan tests => 12;
     use_ok('MooseX::Storage');
 }
 
@@ -36,16 +40,16 @@ BEGIN {
         object => Foo->new( number => 2 ),
     );
     isa_ok( $foo, 'Foo' );
-    
+
     my $yaml = $foo->freeze;
-    
-    yaml_string_ok($yaml, '... we got valid YAML out of it');
-    
+
+    yaml_string_ok( $yaml, '... we got valid YAML out of it' );
+
     is(
         $yaml,
-        q{--- 
+        q{---
 __CLASS__: Foo
-array: 
+array:
   - 1
   - 2
   - 3
@@ -57,7 +61,7 @@ array:
   - 9
   - 10
 float: 10.5
-hash: 
+hash:
   1: ~
   10: ~
   2: ~
@@ -69,19 +73,21 @@ hash:
   8: ~
   9: ~
 number: 10
-object: 
+object:
   __CLASS__: Foo
   number: 2
 string: foo
 },
-    '... got the same YAML');
-    
+        '... got the same YAML'
+    );
+
 }
 
 {
-    my $foo = Foo->thaw(q{--- 
+    my $foo = Foo->thaw(
+        q{---
 __CLASS__: Foo
-array: 
+array:
   - 1
   - 2
   - 3
@@ -93,7 +99,7 @@ array:
   - 9
   - 10
 float: 10.5
-hash: 
+hash:
   1: ~
   10: ~
   2: ~
@@ -105,11 +111,12 @@ hash:
   8: ~
   9: ~
 number: 10
-object: 
+object:
   __CLASS__: Foo
   number: 2
 string: foo
-});
+}
+    );
     isa_ok( $foo, 'Foo' );
 
     is( $foo->number, 10,    '... got the right number' );