Index: trunk/PS-IPP-Metadata-Config/t/05_time.t
===================================================================
--- trunk/PS-IPP-Metadata-Config/t/05_time.t	(revision 8940)
+++ trunk/PS-IPP-Metadata-Config/t/05_time.t	(revision 9758)
@@ -3,5 +3,5 @@
 # Copyright (C) 2005  Joshua Hoblitt
 #
-# $Id: 05_time.t,v 1.3 2006-09-25 21:49:42 jhoblitt Exp $
+# $Id: 05_time.t,v 1.4 2006-10-27 02:15:45 jhoblitt Exp $
 
 use strict;
@@ -12,5 +12,5 @@
 #$::RD_TRACE = 1;
 
-use Test::More tests => 10;
+use Test::More tests => 17;
 use PS::IPP::Metadata::Config;
 
@@ -19,4 +19,135 @@
 {
 my $example =<<END;
+mytime  MULTI
+mytime  UTC     NULL
+mytime  UT1     NULL
+mytime  TAI     NULL
+mytime  TT      NULL
+END
+
+    my $config = $config_parser->parse( $example );
+    ok( defined( $config ), "NULL times parsed");
+
+    my $tree = [
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'UTC',
+            value   => undef,
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'UT1',
+            value   => undef,
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'TAI',
+            value   => undef,
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'TT',
+            value   => undef,
+        },
+    ];
+
+    is_deeply( $config, $tree, "NULL times structure" );
+}
+
+{
+my $example =<<END;
+mytime  MULTI
+mytime  UTC     NULL    # comment
+mytime  UT1     NULL    # comment
+mytime  TAI     NULL    # comment
+mytime  TT      NULL    # comment
+END
+
+    my $config = $config_parser->parse( $example );
+    ok( defined( $config ), "NULL times with comments parsed");
+
+    my $tree = [
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'UTC',
+            value   => undef,
+            comment => 'comment',
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'UT1',
+            value   => undef,
+            comment => 'comment',
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'TAI',
+            value   => undef,
+            comment => 'comment',
+        },
+        {
+            name    => 'mytime',
+            class   => 'time',
+            type    => 'TT',
+            value   => undef,
+            comment => 'comment',
+        },
+    ];
+
+    is_deeply( $config, $tree, "NULL times with comments structure" );
+}
+
+{
+my $example =<<END;
+recently    MULTI
+recently    UTC     2005-03-18T16:05:00
+recently    UT1     2005-03-18T16:05:00
+recently    TAI     2005-03-18T16:05:00
+recently    TT      2005-03-18T16:05:00
+END
+
+    my $config = $config_parser->parse( $example );
+    ok( defined( $config ), "basic ISO8601 parsed");
+
+    my $tree = [
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'UTC',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'UT1',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'TAI',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'TT',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+    ];
+
+    is_deeply( $config, $tree, "basic ISO8601 structure" );
+}
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     2005-03-18T16:05:00Z
 recently    UT1     2005-03-18T16:05:00Z
@@ -24,10 +155,41 @@
 recently    TT      2005-03-18T16:05:00Z
 END
-    my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "basic IS8601");
-}
-
-{
-my $example =<<END;
+
+    my $config = $config_parser->parse( $example );
+    ok( defined( $config ), "basic ISO8601 w/Z parsed");
+
+    my $tree = [
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'UTC',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'UT1',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'TAI',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+        {
+            name    => 'recently',
+            class   => 'time',
+            type    => 'TT',
+            value   => DateTime::Format::ISO8601->parse_datetime("2005-03-18T16:05:00Z"),
+        },
+    ];
+
+    is_deeply( $config, $tree, "basic ISO8601 w/Z structure" );
+}
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     2005-03-18T16:05:00.000001Z
 recently    UT1     2005-03-18T16:05:00.000001Z
@@ -36,9 +198,10 @@
 END
     my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "basic IS8601 with fractional seconds");
-}
-
-{
-my $example =<<END;
+    ok( defined( $config ), "basic IS8601 with fractional seconds parsed");
+}
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     2005-03-18T16:05:00Z    # foo
 recently    UT1     2005-03-18T16:05:00Z    # bar
@@ -47,9 +210,10 @@
 END
     my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "ISO8601 with comments");
-}
-
-{
-my $example =<<END;
+    ok( defined( $config ), "ISO8601 with comments parsed");
+}
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     2005-03-18T16:05:00.000001Z    # foo
 recently    UT1     2005-03-18T16:05:00.000001Z    # bar
@@ -58,9 +222,12 @@
 END
     my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "ISO8601 with comments and fractional seconds");
-}
-
-{
-my $example =<<END;
+    ok( defined( $config ), "ISO8601 with comments and fractional seconds parsed");
+}
+
+diag("epoch time format maybe deprecated");
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     123456, 5000, 1
 recently    UT1     123456, 5000
@@ -69,9 +236,10 @@
 END
     my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "basic epoch time");
-}
-
-{
-my $example =<<END;
+    ok( defined( $config ), "basic epoch time parsed");
+}
+
+{
+my $example =<<END;
+recently    MULTI
 recently    UTC     123456, 5000, 1         # foo
 recently    UT1     123456, 5000            # bar
@@ -80,36 +248,36 @@
 END
     my $config = $config_parser->parse( $example );
-    ok( defined( $config ), "epoch time with comments");
-}
-
-{
-my $example =<<END;
-broken      UTC     2005-03-18T16:05:00
-END
-    my $config = $config_parser->parse( $example );
-    ok( !defined( $config ), "bad format");
-}
-
-{
-my $example =<<END;
-broken      UT1     2005-03-18T16:05:00
-END
-    my $config = $config_parser->parse( $example );
-    ok( !defined( $config ), "bad format");
-}
-
-{
-my $example =<<END;
-broken      TAI     2005-03-18T16:05:00
-END
-    my $config = $config_parser->parse( $example );
-    ok( !defined( $config ), "bad format");
-}
-
-{
-my $example =<<END;
-broken      TT      2005-03-18T16:05:00
-END
-    my $config = $config_parser->parse( $example );
-    ok( !defined( $config ), "bad format");
-}
+    ok( defined( $config ), "epoch time with comments parsed");
+}
+
+{
+my $example =<<END;
+broken      UTC     2005-03-18 16:05:00
+END
+    my $config = $config_parser->parse( $example );
+    ok( !defined( $config ), "bad format");
+}
+
+{
+my $example =<<END;
+broken      UT1     2005-03-18 16:05:00
+END
+    my $config = $config_parser->parse( $example );
+    ok( !defined( $config ), "bad format");
+}
+
+{
+my $example =<<END;
+broken      TAI     2005-03-18 16:05:00
+END
+    my $config = $config_parser->parse( $example );
+    ok( !defined( $config ), "bad format");
+}
+
+{
+my $example =<<END;
+broken      TT      2005-03-18 16:05:00
+END
+    my $config = $config_parser->parse( $example );
+    ok( !defined( $config ), "bad format");
+}
