Changeset 3487
- Timestamp:
- Mar 23, 2005, 2:13:02 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-Metadata-Config/t/02_examples.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Metadata-Config/t/02_examples.t
r3482 r3487 3 3 # Copyright (C) 2005 Joshua Hoblitt 4 4 # 5 # $Id: 02_examples.t,v 1. 2 2005-03-23 06:48:04jhoblitt Exp $5 # $Id: 02_examples.t,v 1.3 2005-03-24 00:13:02 jhoblitt Exp $ 6 6 7 7 use strict; … … 12 12 #$::RD_TRACE = 1; 13 13 14 use Test::More tests => 3;14 use Test::More tests => 5; 15 15 use PS::IPP::Metadata::Config; 16 16 … … 106 106 value => 'key', 107 107 }, 108 ]; 109 110 is_deeply( $config, $tree, "SDRS example structure, no overwrite" ); 111 } 112 113 { 114 my $example = q{ 115 Double F64 1.23456789 # This is a comment 116 Float F32 0.98765#This is a comment too 117 String STR This is the string that forms the value #comment 118 119 # This is a comment line and is to be ignored 120 boolean BOOL T # The value of `boolean' is `true' 121 122 @primes U8 2,3 5 7,11,13 17 # These are prime numbers 123 124 comment MULTI # The rest of this line is ignored, but `comment' is set to be non-unique 125 comment STR This 126 comment STR is 127 comment STR a 128 comment STR non-unique 129 comment STR key 130 Float F64 1.23456 # This generates a warning, and, if `overwrite' is `false', is ignored 131 }; 132 $config_parser->overwrite( 1 ); 133 my $config = $config_parser->parse( $example ); 134 135 ok( defined( $config ), "SDRS example parsed"); 136 137 my $tree = [ 138 { 139 name => 'Double', 140 class => 'scalar', 141 type => 'F64', 142 value => '1.23456789', 143 comment => 'This is a comment', 144 }, 145 { 146 name => 'String', 147 class => 'scalar', 148 type => 'STR', 149 value => 'This is the string that forms the value', 150 comment => 'comment', 151 }, 152 { 153 name => 'boolean', 154 class => 'scalar', 155 type => 'BOOL', 156 value => 1, 157 comment => q{The value of `boolean' is `true'}, 158 }, 159 { 160 name => 'primes', 161 class => 'vector', 162 type => 'U8', 163 value => [qw( 2 3 5 7 11 13 17 )], 164 comment => 'These are prime numbers', 165 }, 166 { 167 name => 'comment', 168 class => 'scalar', 169 type => 'STR', 170 value => 'This', 171 }, 172 { 173 name => 'comment', 174 class => 'scalar', 175 type => 'STR', 176 value => 'is', 177 }, 178 { 179 name => 'comment', 180 class => 'scalar', 181 type => 'STR', 182 value => 'a', 183 }, 184 { 185 name => 'comment', 186 class => 'scalar', 187 type => 'STR', 188 value => 'non-unique', 189 }, 190 { 191 name => 'comment', 192 class => 'scalar', 193 type => 'STR', 194 value => 'key', 195 }, 108 196 { 109 197 name => 'Float', … … 115 203 ]; 116 204 117 is_deeply( $config, $tree, "SDRS example structure " );205 is_deeply( $config, $tree, "SDRS example structure, with overwrite" ); 118 206 } 119 207
Note:
See TracChangeset
for help on using the changeset viewer.
