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 from-loop tests #120

Merged
merged 4 commits into from
May 16, 2016
Merged

Add from-loop tests #120

merged 4 commits into from
May 16, 2016

Conversation

titsuki
Copy link
Member

@titsuki titsuki commented May 14, 2016

Fix #114

I have added tests for the from-loop method according to the following page
https://doc.perl6.org/routine/from-loop#class_Seq

But I don't have very much confidence. Can anyone review this tests ?

The following is the results of the from-loop tests

not ok 29 - from-loop(&body) returns a Seq

# Failed test 'from-loop(&body) returns a Seq'
# at ./S32-list/seq.t line 133
ok 30 - the Seq object is lazy
not ok 31 - from-loop(&body, &condition) returns a Seq

# Failed test 'from-loop(&body, &condition) returns a Seq'
# at ./S32-list/seq.t line 137
ok 32 - from-loop(&body, &condition) terminates calling &body if &condition returns False
not ok 33 - from-loop(&body, &condition, &afterward) returns a Seq

# Failed test 'from-loop(&body, &condition, &afterward) returns a Seq'
# at ./S32-list/seq.t line 143
ok 34 - &afterward is called after each call to &body.
ok 35 - from-loop(&body, &condition, &afterward) terminates calling &body if &condition returns False

@titsuki
Copy link
Member Author

titsuki commented May 14, 2016

Sorry, I have fixed the way to check the returned type.
And the following is the results

ok 29 - from-loop(&body) returns a Seq
ok 30 - the Seq object is lazy
ok 31 - from-loop(&body, &condition) returns a Seq
ok 32 - from-loop(&body, &condition) terminates calling &body if &condition returns False
ok 33 - from-loop(&body, &condition, &afterward) returns a Seq
ok 34 - &afterward is called after each call to &body.
ok 35 - from-loop(&body, &condition, &afterward) terminates calling &body if &condition returns False

@salortiz
Copy link
Contributor

@titsuki
The type of an object can be tested by

isa-ok Seq.from-loop({ 1 }), Seq, "Bla, bla";

and you can avoid the coercion to Array using a Scalar variable (or sigilless):

     my $foo = Seq.from-loop({ 1 });
     ok $foo.is-lazy, …

@titsuki
Copy link
Member Author

titsuki commented May 15, 2016

@salortiz
Thank you for your advice !
I have fixed your pointer.

@titsuki titsuki merged commit 76794a4 into Raku:master May 16, 2016
@titsuki titsuki deleted the add-from-loop-test branch May 16, 2016 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants