Data-Google-Visualization-DataTable

 view release on metacpan or  search on metacpan

t/020_common_exceptions.t  view on Meta::CPAN

#!/usr/bin/perl

use strict;
use warnings;
use Data::Google::Visualization::DataTable;
use Test::More;
use Scalar::Util qw(weaken);

BEGIN {
	eval "use Test::Exception";
	plan skip_all => "Test::Exception needed for these tests" if $@;
}

plan tests => 8;

# Add a column, add a row, then add another column
{

t/020_common_exceptions.t  view on Meta::CPAN

			qr/'$key' needs to be a simple string/,
			"Adding a reference for '$key' caught";
	}
}

# Nonsense column p
{
	my $datatable = Data::Google::Visualization::DataTable->new();
	my $circular = [];
	push(@$circular, $circular);
	weaken $circular;

	throws_ok
		{ $datatable->add_columns( { type => 'string', p => $circular } ) }
		qr/Serializing 'p' failed/,
		"Unserializable p caught";
}

# Catch non-unique columns
{
	my $datatable = Data::Google::Visualization::DataTable->new();



( run in 0.353 second using v1.01-cache-2.11-cpan-65fba6d93b7 )