IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6606


Ignore:
Timestamp:
Mar 16, 2006, 11:51:46 AM (20 years ago)
Author:
jhoblitt
Message:

test ->parse()'s return in list and scalar context

Location:
trunk/DataStore/t
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/t/02_fileset_parse.t

    r6501 r6606  
    33# Copyright (C) 2006  Joshua Hoblitt
    44#
    5 # $Id: 02_fileset_parse.t,v 1.5 2006-02-28 03:02:12 jhoblitt Exp $
     5# $Id: 02_fileset_parse.t,v 1.6 2006-03-16 21:51:46 jhoblitt Exp $
    66
    77use strict;
     
    1010use lib qw( ./lib ./t );
    1111
    12 use Test::More tests => 42;
     12use Test::More tests => 43;
    1313use Test::Warn;
    1414
     
    117117        base_uri => 'http://foo.com/'
    118118    );
     119    my @results = $parser->parse($example1);
     120
     121    is(scalar @results, 4, "correct number of item returned in list context");
     122}
     123
     124{
     125    # multi-row example
     126my $example1 =<<END;
     127# filesetID|time registered    |type   |telescope pointing         |etime|f|airmass|
     128otis0123456|2006-01-01T00:03:04Z|object|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
     129otis0123456|2006-01-01T00:03:04Z|object|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
     130otis0123456|2006-01-01T00:03:04Z|object|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
     131otis0123456|2006-01-01T00:03:04Z|object|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
     132END
     133    my $parser  = DataStore::FileSet::Parser->new(
     134        base_uri => 'http://foo.com/'
     135    );
    119136    my $results = $parser->parse($example1);
    120137
    121     is(scalar @$results, 4, "correct number of item returned");
     138    is(scalar @$results, 4,
     139        "correct number of item returned in scalar context");
    122140
    123141    isa_ok(@$results[0], 'DataStore::FileSet');
  • trunk/DataStore/t/03_file_parse.t

    r6501 r6606  
    33# Copyright (C) 2006  Joshua Hoblitt
    44#
    5 # $Id: 03_file_parse.t,v 1.3 2006-02-28 03:02:12 jhoblitt Exp $
     5# $Id: 03_file_parse.t,v 1.4 2006-03-16 21:51:46 jhoblitt Exp $
    66
    77use strict;
     
    1010use lib qw( ./lib ./t );
    1111
    12 use Test::More tests => 45;
     12use Test::More tests => 46;
    1313use Test::Warn;
    1414
     
    128128otis0123456.04|83002312|7bb35e1e30f3f833c0416aea75f90304|chip|ota04   |
    129129END
     130    my @results = DataStore::File::Parser->new->parse($example1);
     131    is(scalar @results, 4, "correct number of item returned in list context");
     132}
     133
     134{
     135    # multi-row example
     136my $example1 =<<END;
     137# fileID      |bytes   |md5sum                          |type|chipname|
     138otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|ota01   |
     139otis0123456.02|83002312|a2b4a7d7b94dc6076c5f3f67239a48c6|chip|ota02   |
     140otis0123456.03|83002312|a39b1510484c7833e27454b181f13981|chip|ota03   |
     141otis0123456.04|83002312|7bb35e1e30f3f833c0416aea75f90304|chip|ota04   |
     142END
    130143    my $results = DataStore::File::Parser->new->parse($example1);
    131144
    132     is(scalar @$results, 4, "correct number of item returned");
     145    is(scalar @$results, 4,
     146        "correct number of item returned in scalar context");
    133147
    134148    isa_ok(@$results[0], 'DataStore::File');
Note: See TracChangeset for help on using the changeset viewer.