Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add some Date subclassing tests
  • Loading branch information
lizmat committed Feb 20, 2016
1 parent f5993d1 commit e1449d6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion S32-temporal/Date.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S32::Temporal/C<Date>>

plan 88;
plan 100;

# construction
{
Expand Down Expand Up @@ -173,3 +173,14 @@ is Date.new('2015-12-29',:formatter({sprintf "%2d/%2d/%4d",.day,.month,.year})),
class BarDate is Date does Foo {}
is BarDate.today.a, [7,8,9], 'did role attributes get initialized ok';
}

{
class FooDate is Date { has $.foo };
for (2016,2,20), '2016-02-20', \(:2016year,:2month,:20day) -> $date {
my $fd = FooDate.new(|$date, foo => 42);
is $fd.year, 2016, "is year in FooDate ok";
is $fd.month, 2, "is month in FooDate ok";
is $fd.day, 20, "is day in FooDate ok";
is $fd.foo, 42, "is foo in FooDate ok";
}
}

0 comments on commit e1449d6

Please sign in to comment.