From 68a2883e332d26c0289230b5c4616b98581057fe Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 28 Dec 2007 20:45:21 +0000 Subject: [PATCH] test suite for new pluggable system --- t/Pluggable.t | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 t/Pluggable.t diff --git a/t/Pluggable.t b/t/Pluggable.t new file mode 100644 index 000000000..dd9dc75a5 --- /dev/null +++ b/t/Pluggable.t @@ -0,0 +1,58 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2007 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------ +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------ + +# Write a little about what this script tests. +# +# + +use FindBin; +use strict; +use lib "$FindBin::Bin/lib"; +use Test::More; +use WebGUI::Test; + + +use WebGUI::Pluggable; + +#---------------------------------------------------------------------------- +# Init + + +#---------------------------------------------------------------------------- +# Tests + +plan tests => 4; # Increment this number for each test you create + +#---------------------------------------------------------------------------- +# put your tests here +eval { WebGUI::Pluggable::load("No::Way::In::Hell") }; +isnt($@, '', "Module shouldn't load."); +eval { WebGUI::Pluggable::load("Config::JSON") }; +is($@, '', "Module should load."); +my $string = WebGUI::Pluggable::run("Data::Dumper","Dumper",[ {color=>"black", make=>"honda"}]); +is($string, q|$VAR1 = { + 'make' => 'honda', + 'color' => 'black' + }; +|, "Can run a function."); +my $dumper = WebGUI::Pluggable::instanciate("Data::Dumper","new",[ [{color=>"black", make=>"honda"}]]); +is($dumper->Dump, q|$VAR1 = { + 'make' => 'honda', + 'color' => 'black' + }; +|, "Can instanciate an object."); + +#---------------------------------------------------------------------------- +# Cleanup + +END { + +} +