IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9495


Ignore:
Timestamp:
Oct 11, 2006, 4:08:51 PM (20 years ago)
Author:
jhoblitt
Message:

add support for empty METADATAs

Location:
trunk/PS-IPP-Metadata-Config
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/Changes

    r9481 r9495  
    11Revision history for Perl module PS::IPP::Metadata::Config
     2
     30.08
     4    - add support for empty METADATAs
    25
    360.07 Tue Oct 10 17:09:28 HST 2006
  • trunk/PS-IPP-Metadata-Config/config_grammar.txt

    r9479 r9495  
    11# Copyright (c) 2005  Joshua Hoblitt
    22#
    3 # $Id: config_grammar.txt,v 1.5 2006-10-11 03:08:36 jhoblitt Exp $
     3# $Id: config_grammar.txt,v 1.6 2006-10-12 02:08:51 jhoblitt Exp $
    44
    55{
     
    8787
    8888metadata:
    89     metadata_name <commit>
     89    metadata_name
    9090    { push @scope_stack, $thisparser->{local}; $thisparser->{local} = {} }
    9191    grammar
     
    103103                $return = undef;
    104104            }
     105
     106            if ( defined $thisparser->{local}{name}{ $item{metadata_name} } ) {
     107                $return->{multi}++
     108                    if $thisparser->{local}{name}{ $item{metadata_name} } =~ /MULTI/;
     109            } else {
     110                $thisparser->{local}{name}{ $item{metadata_name} }++;
     111            }
     112        }
     113    | metadata_name <commit> comment_line(s?) metadata_end
     114        {
     115            $return = {
     116                class   => 'metadata',
     117                name    => $item{metadata_name},
     118                value   => [],
     119            };
    105120
    106121            if ( defined $thisparser->{local}{name}{ $item{metadata_name} } ) {
  • trunk/PS-IPP-Metadata-Config/t/03_metadata.t

    r3841 r9495  
    33# Copyright (C) 2005  Joshua Hoblitt
    44#
    5 # $Id: 03_metadata.t,v 1.3 2005-05-04 22:05:24 jhoblitt Exp $
     5# $Id: 03_metadata.t,v 1.4 2006-10-12 02:08:51 jhoblitt Exp $
    66
    77use strict;
     
    1212#$::RD_TRACE = 1;
    1313
    14 use Test::More tests => 7;
     14use Test::More tests => 9;
    1515use PS::IPP::Metadata::Config;
    1616
     
    177177    ok( defined( $config ), "two metadata at the same depth");
    178178}
     179
     180{
     181my $example = q{
     182foo METADATA
     183END
     184};
     185    my $config = PS::IPP::Metadata::Config->new->parse( $example );
     186
     187    ok( defined( $config ), "empty METADATA");
     188
     189    my $tree = [
     190        {
     191            name    => 'foo',
     192            class   => 'metadata',
     193            value   => [],
     194        },
     195    ];
     196
     197    is_deeply( $config, $tree, "empty METADATA structure");
     198}
Note: See TracChangeset for help on using the changeset viewer.