1#============================================================= -*-perl-*- 2# 3# t/error.t 4# 5# Test that errors are propagated back to the caller as a 6# Template::Exception object. 7# 8# Written by Andy Wardley <abw@kfs.org> 9# 10# Copyright (C) 1996-2000 Andy Wardley. All Rights Reserved. 11# Copyright (C) 1998-2000 Canon Research Centre Europe Ltd. 12# 13# This is free software; you can redistribute it and/or modify it 14# under the same terms as Perl itself. 15# 16# $Id$ 17# 18#======================================================================== 19 20use strict; 21use lib qw( ../lib ); 22use Template::Constants qw( :status ); 23use Template::Test; 24$^W = 1; 25 26 27my $template = Template->new({ 28 BLOCKS => { 29 badinc => "[% INCLUDE nosuchfile %]", 30 }, 31}); 32 33 34ok( ! $template->process('badinc') ); 35my $error = $template->error(); 36ok( $error ); 37ok( ref $error eq 'Template::Exception' ); 38ok( $error->type eq 'file' ); 39ok( $error->info eq 'nosuchfile: not found' ); 40 41 42 43 44