Help language development. Donate to The Perl Foundation

Template6 zef:raku-community-modules last updated on 2023-03-20

use Test;
use Template6;

plan 2;

my $t6 =;
$t6.add-path: 't/templates';

my $wanted = "<html>
<title>Nesting Test</title>
<td>VP Sales</td>

my @users =
  :job<VP Sales>,

is $t6.process('simple-nest', :users(@users)), $wanted, 'Nested data with array of hashes';

class CompanyUser {
  has $.name;
  has $.job;
  has $.birthday;

  method age {
    ## A real application would use today, but our test is hard coded.
    #my $now =;  
    my $now ='2012-07-17');
    return (($now - $.birthday) / 365).Int;

@users =<Bob>,     :job<CEO>,       :birthday('1985-07-13'))),<Lisa>,    :job<Marketing>, :birthday('1994-05-11'))),<Melissa>, :job<VP Sales>,  :birthday('1981-03-21')));

is $t6.process('simple-nest', :users(@users)), $wanted, 'Nested data with array of objects';

# vim: expandtab shiftwidth=4