[Templates-cvs] cvs commit: TT3/t base.t

cvs@template-toolkit.org cvs@template-toolkit.org
Thu, 25 Mar 2004 09:56:35 +0000


cvs         04/03/25 09:56:35

  Modified:    t        base.t
  Log:
  * added tests for throw()
  
  Revision  Changes    Path
  1.10      +20 -2     TT3/t/base.t
  
  Index: base.t
  ===================================================================
  RCS file: /template-toolkit/TT3/t/base.t,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- base.t	2004/03/24 14:16:40	1.9
  +++ base.t	2004/03/25 09:56:35	1.10
  @@ -9,7 +9,7 @@
   # This is free software; you can redistribute it and/or modify it
   # under the same terms as Perl itself.
   #
  -# $Id: base.t,v 1.9 2004/03/24 14:16:40 abw Exp $
  +# $Id: base.t,v 1.10 2004/03/25 09:56:35 abw Exp $
   #
   #========================================================================
   
  @@ -18,7 +18,7 @@
   
   use lib qw( ./lib ../lib );
   use Template::Base;
  -use Test::More tests => 97;
  +use Test::More tests => 99;
   
   # run with -d flag to enable debugging, e.g. perl base.t -d
   $Template::Base::DEBUG = grep(/^--?d(ebug)?/, @ARGV);
  @@ -392,6 +392,24 @@
   ok( $except, 'thrown frobless exception' );
   is( $except->type(), 'frobless', 'type is frobless' );
   is( $except->info(), 'threw frobless error', 'info is threw frobless error' );
  +
  +
  +#------------------------------------------------------------------------
  +# test the throw() method in throwing and re-throwing exceptions
  +#------------------------------------------------------------------------
  +
  +my $base = Template::Base->new();
  +my $ee = Template::Exception->new( engine => 'warp drive offline' );
  +
  +eval { $base->throw( engine => $ee ) };
  +is( "$@", 'engine error - warp drive offline', 'warp drive is offline' );
  +
  +eval { $base->throw( propulsion => $ee ) };
  +is( "$@", 'propulsion error - engine error - warp drive offline', 
  +    'propulsion system is NFG' );
  +
  +
  +#print "$@\n";