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
2d25a15b
Commit
2d25a15b
authored
May 24, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `assert_*` method instead of using result value.
Use `do ... end` for test block.
parent
229e7fe2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
mrbgems/mruby-fiber/test/fiber.rb
mrbgems/mruby-fiber/test/fiber.rb
+19
-19
No files found.
mrbgems/mruby-fiber/test/fiber.rb
View file @
2d25a15b
assert
(
'Fiber.new'
)
{
assert
(
'Fiber.new'
)
do
f
=
Fiber
.
new
{}
f
.
class
==
Fiber
}
assert_kind_of
Fiber
,
f
end
assert
(
'Fiber#resume'
)
{
f
=
Fiber
.
new
{
|
x
|
x
==
2
}
f
.
resume
(
2
)
}
assert
(
'Fiber#resume'
)
do
f
=
Fiber
.
new
{
|
x
|
x
}
assert_equal
2
,
f
.
resume
(
2
)
end
assert
(
'Fiber#transfer'
)
do
f2
=
nil
...
...
@@ -29,14 +29,13 @@ assert('Fiber#transfer') do
assert_false
f2
.
alive?
end
assert
(
'Fiber#alive?'
)
{
assert
(
'Fiber#alive?'
)
do
f
=
Fiber
.
new
{
Fiber
.
yield
}
f
.
resume
r1
=
f
.
alive?
assert_true
f
.
alive?
f
.
resume
r2
=
f
.
alive?
r1
==
true
and
r2
==
false
}
assert_false
f
.
alive?
end
assert
(
'Fiber#=='
)
do
root
=
Fiber
.
current
...
...
@@ -51,16 +50,17 @@ assert('Fiber#==') do
assert_true
f
!=
root
end
assert
(
'Fiber.yield'
)
{
f
=
Fiber
.
new
{
|
x
|
Fiber
.
yield
(
x
==
3
)}
f
.
resume
(
3
)
}
assert
(
'Fiber.yield'
)
do
f
=
Fiber
.
new
{
|
x
|
Fiber
.
yield
x
}
assert_equal
3
,
f
.
resume
(
3
)
assert_true
f
.
alive?
end
assert
(
'FiberError'
)
do
assert_equal
StandardError
,
FiberError
.
superclass
end
assert
(
'Fiber iteration'
)
{
assert
(
'Fiber iteration'
)
do
f1
=
Fiber
.
new
{
[
1
,
2
,
3
].
each
{
|
x
|
Fiber
.
yield
(
x
)}
}
...
...
@@ -72,8 +72,8 @@ assert('Fiber iteration') {
a
<<
f1
.
resume
a
<<
f2
.
resume
}
a
==
[
1
,
9
,
2
,
8
,
3
,
7
]
}
a
ssert_equal
[
1
,
9
,
2
,
8
,
3
,
7
],
a
end
assert
(
'Fiber with splat in the block argument list'
)
{
Fiber
.
new
{
|*
x
|
x
}.
resume
(
1
)
==
[
1
]
...
...
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