# Copyright (c) 2006-2010 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: ClassLoader.bunit,v 1.5 2010/04/09 23:47:02 nagler Exp $ config({ 'Bivio::IO::ClassLoader' => { maps => { ClassLoaderBunit => [ 'Bivio::IO::t::ClassLoader', 'Bivio::IO::t::ClassLoader::After', ], }, delegates => { 'ClassLoaderBunit::Delegate' => 'Bivio::IO::t::ClassLoader::Valid', }, }, }); my($importers) = sub { my($num) = @_; return sub { assert_equals( [map('Bivio::Test', 1..$num)], Bivio::IO::t::ClassLoader::Valid->get_importers, ); return 1; } => 1, }; [ class() => [ is_map_configured => [ NoSuchMap => 0, ClassLoaderBunit => 1, ], was_required => [ 'Bivio::IO::ClassLoader' => 1, 'Bivio::IO::t::ClassLoader::Valid' => 0, 'Bivio::IO::t::ClassLoader::SyntaxError' => 0, ], unsafe_simple_require => [ 'Bivio::IO::t::ClassLoader::Valid' => 'Bivio::IO::t::ClassLoader::Valid', ], $importers->(1), map(( simple_require => [ @$_, ], unsafe_simple_require => [ $_->[0] => $_->[1]->eq_not_found ? [undef] : $_->[1], ], was_required => [ $_->[0] => 0, ], ), ['Bivio::IO::t::ClassLoader::NotFound' => NOT_FOUND()], ['Bivio::IO::t::ClassLoader::SyntaxError' => DIE()], ), map(( unsafe_map_require => [ $_ => 'Bivio::IO::t::ClassLoader::Valid', ], was_required => [ 'Bivio::IO::t::ClassLoader::Valid' => 1, ], $importers->(1), delete_require => [ 'Bivio::IO::t::ClassLoader::Valid' => undef, ], was_required => [ 'Bivio::IO::t::ClassLoader::Valid' => 0, ], ), [qw(ClassLoaderBunit Valid)], 'ClassLoaderBunit.Valid', [qw(NoSuchMapButOK Bivio::IO::t::ClassLoader::Valid)], 'Bivio::IO::t::ClassLoader::Valid', ), map_require_all => [ ClassLoaderBunit => DIE(), [ClassLoaderBunit => sub {shift !~ /SyntaxError/}] => [['Bivio::IO::t::ClassLoader::Valid']], ], delete_require => [ 'Bivio::IO::t::ClassLoader::Valid' => undef, ], delegate_require => [ 'ClassLoaderBunit::Delegate' => 'Bivio::IO::t::ClassLoader::Valid', 'NotConfigured' => DIE(), ], after_in_map => [ ['ClassLoaderBunit', 'Bivio::IO::t::ClassLoader::Valid'] => 'Bivio::IO::t::ClassLoader::After::Valid', ['ClassLoaderBunit', 'Bivio::IO::t::ClassLoader::After::Valid'] => qr{find package after}, ], call_autoload => [ ['ANYTHING::Bivio_Die', []] => 'Bivio::Die', ['ANYTHING::Collection_Attributes', [{a => 1}]] => [{a => 1}], ['ANYTHING::not_valid', []] => qr{not_valid:.*not found}, ['ANYTHING::not_valid', [], []] => qr{not_valid:.*not found}, ], $importers->(1), unsafe_map_for_package => [ 'Bivio::IO::t::ClassLoader::Valid' => 'ClassLoaderBunit', 'Bivio::IO::t::NotFound' => [undef], ], ], ];