Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Created August 9, 2018 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/82efbc2821bb908515125d087b457735 to your computer and use it in GitHub Desktop.
Save zoffixznet/82efbc2821bb908515125d087b457735 to your computer and use it in GitHub Desktop.
use v6.d.PREVIEW;
use Test;
plan 100_000;
for ^100_000 {
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';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment