[Templates-cvs] cvs commit: Template2/t stash-xs.t

cvs@template-toolkit.org cvs@template-toolkit.org


cvs         06/01/29 11:38:55

  Modified:    t        stash-xs.t
  Log:
  * added/updated tests to include fallback tests on objects, etc.
  
  Revision  Changes    Path
  2.8       +27 -11    Template2/t/stash-xs.t
  
  Index: stash-xs.t
  ===================================================================
  RCS file: /template-toolkit/Template2/t/stash-xs.t,v
  retrieving revision 2.7
  retrieving revision 2.8
  diff -u -r2.7 -r2.8
  --- stash-xs.t	2006/01/05 10:13:51	2.7
  +++ stash-xs.t	2006/01/29 11:38:55	2.8
  @@ -13,7 +13,7 @@
   # This is free software; you can redistribute it and/or modify it
   # under the same terms as Perl itself.
   #
  -# $Id: stash-xs.t,v 2.7 2006/01/05 10:13:51 abw Exp $
  +# $Id: stash-xs.t,v 2.8 2006/01/29 11:38:55 abw Exp $
   #
   #========================================================================
   
  @@ -52,6 +52,7 @@
       obj => bless({
           name => 'an object',
       }, 'AnObject'),
  +    listobj => bless([10, 20, 30], 'AListObject'),
       correct => sub { die @_ },
       buggy => Buggy->new(),
   };
  @@ -143,11 +144,11 @@
   + three
   
   -- test --
  -[% "* $item.key => $item.value\n" FOREACH item = global.mylist.hash -%]
  +[% global.mylist.push('bar');
  +   "* $item.key => $item.value\n" FOREACH item = global.mylist.hash -%]
   -- expect --
  -* 0 => one
  -* 1 => foo
  -* 2 => three
  +* one => foo
  +* three => bar
   
   -- test --
   [% myhash = { msg => 'Hello World', things => global.mylist, a => 'alpha' };
  @@ -158,14 +159,21 @@
   * Hello World
   
   -- test --
  -[% "* $item.key => $item.value.item\n" 
  -    FOREACH item = global.myhash.list.sort('key') -%]
  +[% global.myhash.delete('things') -%]
  +keys: [% global.myhash.keys.sort.join(', ') %]
   -- expect --
  -* a => alpha
  -* msg => Hello World
  -* things => one
  +keys: a, msg
   
   -- test --
  +[% "* $item\n" 
  +    FOREACH item IN global.myhash.list.sort -%]
  +-- expect --
  +* a
  +* alpha
  +* Hello World
  +* msg
  +
  +-- test --
   [% items = [ 'foo', 'bar', 'baz' ];
      take  = [ 0, 2 ];
      slice = items.$take;
  @@ -233,11 +241,18 @@
   -- expect --
   an object
   
  +-- test --
  +[% obj.list.first %]
  +-- expect --
  +name
  +
  +
   -- test --
  -[% obj.list.first.name %]
  +[% obj.list.1 %]
   -- expect --
   an object
   
  +
   -- test --
   =[% size %]=
   -- expect --
  @@ -273,4 +288,5 @@
   
   -- expect --
   message: Hello World
  +