# Copyright (c) 2006 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: StringArray.bunit,v 1.11 2009/05/01 17:22:22 nagler Exp $ Type(); options({ compute_return => sub { shift; return [map(ref($_) eq class() ? $_->as_array : $_, @{shift(@_)})]; }, }); [ new => [ [undef] => [[]], [''] => [[]], [['a']] => [['a']], [class()->new('a')] => [['a']], ], from_literal => [ '' => [[], undef], ' ' => [[], undef], [[]] => [[], undef], [class()->new([])] => [[], undef], '0' => [[qw(0)], undef], ' a,b ' => [[qw(a b)], undef], "a,b$;c" => [['a', 'b', 'c'], undef], [[qw(a b)]] => [[qw(a b)], undef], [class()->new([qw(a b)])] => [[qw(a b)], undef], ], compare_defined => [ [class->()->new([qw(a b)]), [qw(a b)]] => 0, [[qw(a b)], [qw(a b)]] => 0, [[qw(a a)], [qw(a b)]] => -1, [[qw(a c)], [qw(a b)]] => 1, [[qw(a)], [qw(a b)]] => -1, [[qw(a b c)], [qw(a b)]] => 1, [['a', undef], ['a']] => 0, [['a'], ['a', '']] => 0, [[undef, 'a'], ['a']] => -1, [['', 'a'], ['a']] => -1, [[''], []] => 0, ], to_sql_param => [ [] => [undef], [[]] => [undef], [[qw(a)]] => 'a', [[qw(a b)]] => "a$;b", [["a$;b"]] => DIE(), ['a'] => DIE(), ], from_sql_column => [ [] => [[]], [''] => [[]], ['a'] => [[qw(a)]], "a$;b" => [[qw(a b)]], "$;a" => [['', 'a']], ], to_literal => [ [] => '', [[]] => '', [[undef,undef]] => '', [[qw(a)]] => 'a', [[qw(a b)]] => 'a, b', [['a,b']] => DIE(), ['a'] => DIE(), ], sort_unique => [ [[]] => [[]], [[qw(a b)]] => [[qw(a b)]], [[qw(b a a)]] => [[qw(a b)]], ], ];