Skip to content

Commit e1fe3ed

Browse files
committed
[v.6 REVIEW] Improve DateTime subclass tests
- Use proper test routines - Test type of created object - Lexicalize the test class Orig: e1449d6
1 parent c44a301 commit e1fe3ed

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

S32-temporal/Date.t

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use Test;
33

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

6-
plan 116;
6+
plan 122;
77

88
# construction
99
{
@@ -176,13 +176,15 @@ is Date.new('2015-12-29',:formatter({sprintf "%2d/%2d/%4d",.day,.month,.year})),
176176
}
177177

178178
{
179-
class FooDate is Date { has $.foo };
179+
my class FooDate is Date { has $.foo };
180180
for (2016,2,20), '2016-02-20', \(:2016year,:2month,:20day) -> $date {
181181
my $fd = FooDate.new(|$date, foo => 42);
182-
is $fd.year, 2016, "is year in FooDate ok";
183-
is $fd.month, 2, "is month in FooDate ok";
184-
is $fd.day, 20, "is day in FooDate ok";
185-
is $fd.foo, 42, "is foo in FooDate ok";
182+
isa-ok $fd, FooDate, 'created object is of right type';
183+
isa-ok $fd, Date, 'created object is a subclass';
184+
is-deeply $fd.year, 2016, 'is year in FooDate ok';
185+
is-deeply $fd.month, 2, 'is month in FooDate ok';
186+
is-deeply $fd.day, 20, 'is day in FooDate ok';
187+
is-deeply $fd.foo, 42, 'is foo in FooDate ok';
186188
}
187189
}
188190

0 commit comments

Comments
 (0)