Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Converting Inf/NaN to Int throws with correct message
This removes the fudged tests that tested now-rejected behaviour discussed in
RT#124453 and replaces them with the tests testing accepted behaviour.
  • Loading branch information
zoffixznet committed Jul 11, 2016
1 parent 679a57f commit 697b460
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions S02-types/infinity.t
Expand Up @@ -40,10 +40,24 @@ plan 15;
# ~Inf eq ~Inf # true

ok truncate(Inf) ~~ Inf, 'truncate(Inf) ~~ Inf';
#?rakudo 3 todo 'Int conversion of NaN and Inf RT #124453'
ok NaN.Int === NaN, 'Inf.Int === Int';
ok Inf.Int === Inf, 'Inf.Int === Int';
ok (-Inf).Int === (-Inf), 'Inf.Int === Int';

# RT #124453
{
throws-like { Inf.Int }, X::AdHoc, :message<Cannot coerce Inf to an Int>,
'attempting to convert Inf to Int throws';

throws-like { -Inf.Int }, X::AdHoc, :message<Cannot coerce -Inf to an Int>,
'attempting to convert Inf to Int throws';

throws-like { ∞.Int }, X::AdHoc, :message<Cannot coerce Inf to an Int>,
'attempting to convert ∞ to Int throws';

throws-like { -∞.Int }, X::AdHoc, :message<Cannot coerce Inf to an Int>,
'attempting to convert -∞ to Int throws';

throws-like { NaN.Int }, X::AdHoc, :message<Cannot coerce NaN to an Int>,
'attempting to convert NaN to Int throws';
}

# RT #70730
{
Expand Down

0 comments on commit 697b460

Please sign in to comment.