--- trunk/t/3-normalize-set.t 2006/05/13 12:37:35 476 +++ trunk/t/3-normalize-set.t 2006/05/14 11:06:42 485 @@ -2,7 +2,7 @@ use strict; -use Test::More tests => 43; +use Test::More tests => 56; use Test::Exception; use Cwd qw/abs_path/; use blib; @@ -171,6 +171,48 @@ ), 'eq', 'lookup 1 i lookup 2', 'join lookup regex rec2'); + # check join_with operations + + sub test_join_with_2 { + my ($a,$b,$e) = @_; + + cmp_ok( + join_with(" <1> ", + rec('201',$a), + rec('201',$b), + ), + 'eq', $e, "join_with $a <1> $b = $e"); + } + + test_join_with_2('_','_',''); + test_join_with_2('x','_','201x'); + test_join_with_2('_','x','201x'); + test_join_with_2('x','y','201x <1> 201y'); + + sub test_join_with_3 { + my ($a,$b,$c,$e) = @_; + + cmp_ok( + join_with(" <1> ", rec('201',$a), + join_with(" <2> ", rec('201',$b), + rec('201',$c), + ) + ), + 'eq', $e, "join_with $a <1> $b <2> $c = $e"); + }; + + test_join_with_3('_','_','_',''); + test_join_with_3('x','_','_','201x'); + test_join_with_3('_','x','_','201x'); + test_join_with_3('_','_','x','201x'); + test_join_with_3('x','y','_','201x <1> 201y'); + test_join_with_3('x','_','y','201x <1> 201y'); + test_join_with_3('_','x','y','201x <2> 201y'); + test_join_with_3('x','_','y','201x <1> 201y'); + test_join_with_3('x','y','x','201x <1> 201y <2> 201x'); + + # test lookups + set_lookup( $lookup2 ); is_deeply( \[ lookup( prefix( '00', rec('902') ) ) ], \[ 'lookup' ], 'lookup prefix' );