[Templates-cvs] cvs commit: TT3/t/vobject text.t

cvs@template-toolkit.org cvs@template-toolkit.org
Mon, 29 Mar 2004 17:41:31 +0100


cvs         04/03/29 16:41:31

  Added:       t/vobject text.t
  Log:
  * added t/vobject/text.t
  
  Revision  Changes    Path
  1.1                  TT3/t/vobject/text.t
  
  Index: text.t
  ===================================================================
  #============================================================= -*-perl-*-
  #
  # t/vobject/text.t
  #
  # Test the Template::VObject::Text module.
  #
  # Written by Andy Wardley <abw@wardley.org>
  #
  # This is free software; you can redistribute it and/or modify it
  # under the same terms as Perl itself.
  #
  # $Id: text.t,v 1.1 2004/03/29 16:41:31 abw Exp $
  #
  #========================================================================
  
  use strict;
  use warnings;
  
  use lib qw( ./lib ../lib ../../lib );
  use Template::VObject::Text;
  use Test::More tests => 6;
  
  my $DEBUG = 
  $Template::VObject::Text::DEBUG = 
  grep(/^--?d(ebug)?/, @ARGV);
  
  
  my $Text = 'Template::VObject::Text';
  my $text = $Text->new('Hello World');
  
  is( $$text, 'Hello World', 'Hello World by ref' );
  is( $text->text(), 'Hello World', 'Hello World by method' );
  is( $text->upper(), 'HELLO WORLD', 'HELLO WORLD upper' );
  is( $text->lower(), 'hello world', 'hello world lower' );
  is( $text->text(), 'Hello World', 'Hello World unchanged' );
  
  my $upper = $text->can('upper');
  my $source = 'Goodbye Cruel World';
  is( &$upper(\$source), 'GOODBYE CRUEL WORLD', 'upper sub call' );
  
  __END__
  
  # Local Variables:
  # mode: perl
  # perl-indent-level: 4
  # indent-tabs-mode: nil
  # End:
  #
  # vim: expandtab shiftwidth=4: