Web::Chain project: Web/Chain/t/Web-Chain-IO.t
# Test file created outside of h2xs framework.
# Run this like so: `perl Web-Chain-IO.t'
# doom@kzsu.stanford.edu 2004/09/26 03:41:38
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use warnings;
use strict;
$|=1;
use FindBin qw($Bin);
use Test::More;
BEGIN { plan tests => 4 };
use Web::Chain::IO;
use Web::Definitions qw($DEBUG);
use Quantum::Superpositions; # to import "any"
ok(1); # If we made it this far, we're ok.
#--------
# Test list_data_formats
my $io_obj = Web::Chain::IO->new;
my @formats = $io_obj->list_data_formats;
($DEBUG) && print STDERR "existing formats: " . join( ' ', @formats) . "\n";
my $format_modules_loc = "$Bin/IO"; # /home/doom/lib/perl/Web/Chain/IO
chdir($format_modules_loc);
my @files = <*.pm>;
my $expected_count = scalar(@files) - 1; # Know that there's one file there that's not a format: Common.pm
my $count = scalar(@formats);
is($count, $expected_count, "Testing that list_data_formats reports the right number of formats");
is ( 'Html', any( @formats ), "Testing that Html is a valid existing data format");
is ( 'Rawtext', any( @formats ), "Testing that Rawtext is a valid existing data format");
# Don't want to do it this way (will break as new formats are added):
# my @formats_check = sort(@formats);
# my @expected_formats = qw(Html Rawtext);
# is (@formats_check, @expected_formats, "Test that list_data_formats reports what is there");
Joseph Brenner,
Sat Nov 6 17:04:11 2004