Skip to content

Commit

Permalink
Spec num defaults to 0e0 in 6.d
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jul 30, 2018
1 parent 683296b commit 2abee09
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion MISC/misc-6.d.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Test::Util;
# They might be rearranged into other files in the future, but for now, keeping them in this
# file avoids creating a ton of `-6.d.t` files for the sake of single tests.

plan 2;
plan 3;

subtest ':sym<> colonpair on subroutine names is reserved' => {
plan 6;
Expand Down Expand Up @@ -79,4 +79,17 @@ subtest '$*ARGFILES is set to $*IN inside sub MAIN' => {
}, 'no MAIN';
}

subtest 'native num defaults to 0e0' => {
plan 8;
my num $x;
is-deeply $x, 0e0, '`my` variable';
is-deeply my class { has num $.z }.new.z, 0e0, 'class attribute';
is-deeply my role { has num $.z }.new.z, 0e0, 'role attribute';
is-deeply my class { submethod z(num $v?) { $v } }.new.z, 0e0, 'submethod param';
is-deeply my class { method z(num $v?) { $v } }.new.z, 0e0, 'method param';
is-deeply sub (num $v?) { $v }(), 0e0, 'sub param';
is-deeply -> num $v? { $v }(), 0e0, 'block param';
my num @a; is-deeply @a[0], 0e0, 'native num array unset element';
}

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit 2abee09

Please sign in to comment.