Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f392337e
Commit
f392337e
authored
Jan 01, 2019
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for Enumerator::Chain
parent
a98359fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
mrbgems/mruby-enum-chain/test/enum_chain.rb
mrbgems/mruby-enum-chain/test/enum_chain.rb
+76
-0
No files found.
mrbgems/mruby-enum-chain/test/enum_chain.rb
0 → 100644
View file @
f392337e
##
# Enumerator::Chain test
assert
(
"Enumerable#chain"
)
do
a
=
[]
b
=
{}
c
=
Object
.
new
# not has #each method
assert_kind_of
Enumerator
::
Chain
,
a
.
chain
assert_kind_of
Enumerator
::
Chain
,
a
.
chain
(
b
)
assert_kind_of
Enumerator
::
Chain
,
a
.
chain
(
b
,
c
)
assert_raise
(
NoMethodError
)
{
c
.
chain
}
end
assert
(
"Enumerable#+"
)
do
a
=
[].
each
b
=
{}.
reverse_each
c
=
Object
.
new
# not has #each method
assert_kind_of
Enumerator
::
Chain
,
a
+
b
assert_kind_of
Enumerator
::
Chain
,
a
+
c
assert_kind_of
Enumerator
::
Chain
,
b
+
a
assert_kind_of
Enumerator
::
Chain
,
b
+
c
assert_raise
(
NoMethodError
)
{
c
+
a
}
end
assert
(
"Enumerator.new"
)
do
a
=
[]
b
=
{}
c
=
Object
.
new
# not has #each method
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
a
,
a
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
a
,
b
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
a
,
c
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
b
,
a
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
b
,
b
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
b
,
c
)
assert_kind_of
Enumerator
::
Chain
,
Enumerator
::
Chain
.
new
(
c
,
a
)
end
assert
(
"Enumerator::Chain#each"
)
do
a
=
[
1
,
2
,
3
]
aa
=
a
.
chain
(
a
)
assert_kind_of
Enumerator
,
aa
.
each
assert_equal
[
1
,
2
,
3
,
1
,
2
,
3
],
aa
.
each
.
to_a
aa
=
a
.
chain
(
a
.
reverse_each
)
assert_kind_of
Enumerator
,
aa
.
each
assert_equal
[
1
,
2
,
3
,
3
,
2
,
1
],
aa
.
each
.
to_a
aa
=
a
.
chain
(
a
.
reverse_each
,
a
)
assert_kind_of
Enumerator
,
aa
.
each
assert_equal
[
1
,
2
,
3
,
3
,
2
,
1
,
1
,
2
,
3
],
aa
.
each
.
to_a
aa
=
a
.
chain
(
Object
.
new
)
assert_kind_of
Enumerator
,
aa
.
each
assert_raise
(
NoMethodError
)
{
aa
.
each
.
to_a
}
end
assert
(
"Enumerator::Chain#size"
)
do
a
=
[
1
,
2
,
3
]
aa
=
a
.
chain
(
a
)
assert_equal
6
,
aa
.
size
aa
=
a
.
chain
(
a
.
reverse_each
)
assert_nil
aa
.
size
aa
=
a
.
chain
(
a
.
reverse_each
,
a
)
assert_nil
aa
.
size
aa
=
a
.
chain
(
Object
.
new
)
assert_nil
aa
.
size
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment