Skip to content

Commit

Permalink
Test parse-base can take a fractional without a whole part
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 24, 2016
1 parent a529332 commit 897cc99
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion S32-str/parse-base.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 51 * 2;
plan 55 * 2;

constant $fancy-nums = '໕໖໗۶۷៤៥123';
constant $fancy-nums-value = 5676745123;
Expand Down Expand Up @@ -29,6 +29,11 @@ for &parse-base, Str.^lookup('parse-base') -> &pb {
'can parse − sign (fancy Unicode minus)' ~ $t;
is-deeply pb( '+FF', 16), 255, 'can parse + sign';

is-deeply pb( '.42', 10), .42, 'fractional without whole part';
is-deeply pb('+.42', 10), .42, 'fractional without whole part with +';
is-deeply pb('-.42', 10), -.42, 'fractional without whole part with -';
is-deeply pb('−.42', 10), -.42, 'fractional without whole part with U+2212';

#?rakudo.jvm todo 'Invalid base-10 character'
is-deeply pb($fancy-nums, 10), $fancy-nums-value,
'can parse fancy Unicode numerals as Int' ~ $t;
Expand Down

0 comments on commit 897cc99

Please sign in to comment.