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

cvs@template-toolkit.org cvs@template-toolkit.org
Mon, 12 Jan 2004 11:00:46 +0000


cvs         04/01/12 11:00:45

  Modified:    t        base.t
  Log:
  * added tests for version() method
  
  Revision  Changes    Path
  2.1       +25 -2     Template2/t/base.t
  
  Index: base.t
  ===================================================================
  RCS file: /template-toolkit/Template2/t/base.t,v
  retrieving revision 2.0
  retrieving revision 2.1
  diff -u -r2.0 -r2.1
  --- base.t	2000/08/10 14:56:15	2.0
  +++ base.t	2004/01/12 11:00:45	2.1
  @@ -12,7 +12,7 @@
   # This is free software; you can redistribute it and/or modify it
   # under the same terms as Perl itself.
   #
  -# $Id: base.t,v 2.0 2000/08/10 14:56:15 abw Exp $
  +# $Id: base.t,v 2.1 2004/01/12 11:00:45 abw Exp $
   #
   #========================================================================
   
  @@ -20,7 +20,7 @@
   use lib qw( ./lib ../lib );
   use Template::Test;
   
  -ntests(21);
  +ntests(24);
   
   
   #------------------------------------------------------------------------
  @@ -58,6 +58,16 @@
   
   
   #------------------------------------------------------------------------
  +# module to test version
  +#------------------------------------------------------------------------
  +package Template::Version;
  +use Template::Base;
  +use base qw( Template::Base );
  +use vars qw( $ERROR $VERSION );
  +$VERSION = 3.14;
  +
  +
  +#------------------------------------------------------------------------
   # main package, run some tests
   #------------------------------------------------------------------------
   package main;
  @@ -110,3 +120,16 @@
   $mod = $pkg->new({ name => 'bar' });
   ok( $mod && $mod->name eq 'bar' );
   ok( ! $mod->error );
  +
  +#------------------------------------------------------------------------
  +# test version() method
  +#------------------------------------------------------------------------
  +
  +$pkg = 'Template::Version';
  +is( $pkg->version(), 3.14, 'package version' );
  +
  +my $obj = $pkg->new() || die $pkg->error();
  +ok( $obj, 'created a version object' );
  +is( $obj->version(), 3.14, 'object version' );
  +
  +