Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for trailing declarator on conditionally set attribute #699

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion S26-documentation/why-trailing.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 56;
plan 57;

my $pod_index = 0;

Expand Down Expand Up @@ -69,6 +69,7 @@ class Sheep {
#= a sheep
has $.wool; #= usually white
has $.sound is rw = "baa"; #= usually quiet
has $.flock = $!sound ?? True !! False; #= usually with friends

method roar { 'roar!' }
#= not too scary
Expand All @@ -77,10 +78,12 @@ class Sheep {
{
my $wool-attr = Sheep.^attributes.first: *.name eq '$!wool';
my $sound-attr = Sheep.^attributes.first: *.name eq '$!sound';
my $flock-attr = Sheep.^attributes.first: *.name eq '$!flock';
my $roar-method = Sheep.^lookup('roar');
test-trailing(Sheep, 'a sheep');
test-trailing($wool-attr, 'usually white');
test-trailing($sound-attr, 'usually quiet');
test-trailing($flock-attr, 'usually with friends');
test-trailing($roar-method, 'not too scary');
}

Expand Down