Skip to content

Commit 659a27f

Browse files
committed
Merge pull request #103 from perl6/autarch/fix-Instant.perl
Add a test for the round trip of Instant via .perl.EVAL
2 parents 5016fe1 + 8650ef2 commit 659a27f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

S02-types/instants-and-durations.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 15;
4+
plan 33;
55

66
# L<S02/Immutable types/'term now'>
77

@@ -41,6 +41,15 @@ throws-like { Instant.new(123) }, X::Cannot::New, 'Instant.new is illegal';
4141
is $t0 + ($t1 - $t0), $t1, 'Instant A + (Instant B - Instant A) == Instant B';
4242
}
4343

44+
{
45+
for (-2**63, -400.2, -33/7, -1, 0, 1, 33/7, 400.2, 2**32, ) -> $e {
46+
my $i = Instant.from-posix($e, False);
47+
is $i.perl.EVAL, $i, 'Instant round trips properly';
48+
my $i = Instant.from-posix($e, True);
49+
is $i.perl.EVAL, $i, 'Instant round trips properly';
50+
}
51+
}
52+
4453
# See S32-temporal/DateTime-Instant-Duration.t for more.
4554

4655
# vim: ft=perl6

0 commit comments

Comments
 (0)