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
6cf5618b
Commit
6cf5618b
authored
May 25, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:mruby/mruby
parents
6d695707
84116c26
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
30 deletions
+33
-30
mrbgems/mruby-fiber/test/fiber.rb
mrbgems/mruby-fiber/test/fiber.rb
+19
-19
mrbgems/mruby-proc-ext/test/proc.rb
mrbgems/mruby-proc-ext/test/proc.rb
+1
-1
test/t/enumerable.rb
test/t/enumerable.rb
+3
-3
test/t/exception.rb
test/t/exception.rb
+8
-5
test/t/proc.rb
test/t/proc.rb
+2
-2
No files found.
mrbgems/mruby-fiber/test/fiber.rb
View file @
6cf5618b
assert
(
'Fiber.new'
)
{
assert
(
'Fiber.new'
)
do
f
=
Fiber
.
new
{}
f
=
Fiber
.
new
{}
f
.
class
==
Fiber
assert_kind_of
Fiber
,
f
}
end
assert
(
'Fiber#resume'
)
{
assert
(
'Fiber#resume'
)
do
f
=
Fiber
.
new
{
|
x
|
x
==
2
}
f
=
Fiber
.
new
{
|
x
|
x
}
f
.
resume
(
2
)
assert_equal
2
,
f
.
resume
(
2
)
}
end
assert
(
'Fiber#transfer'
)
do
assert
(
'Fiber#transfer'
)
do
f2
=
nil
f2
=
nil
...
@@ -29,14 +29,13 @@ assert('Fiber#transfer') do
...
@@ -29,14 +29,13 @@ assert('Fiber#transfer') do
assert_false
f2
.
alive?
assert_false
f2
.
alive?
end
end
assert
(
'Fiber#alive?'
)
{
assert
(
'Fiber#alive?'
)
do
f
=
Fiber
.
new
{
Fiber
.
yield
}
f
=
Fiber
.
new
{
Fiber
.
yield
}
f
.
resume
f
.
resume
r1
=
f
.
alive?
assert_true
f
.
alive?
f
.
resume
f
.
resume
r2
=
f
.
alive?
assert_false
f
.
alive?
r1
==
true
and
r2
==
false
end
}
assert
(
'Fiber#=='
)
do
assert
(
'Fiber#=='
)
do
root
=
Fiber
.
current
root
=
Fiber
.
current
...
@@ -51,16 +50,17 @@ assert('Fiber#==') do
...
@@ -51,16 +50,17 @@ assert('Fiber#==') do
assert_true
f
!=
root
assert_true
f
!=
root
end
end
assert
(
'Fiber.yield'
)
{
assert
(
'Fiber.yield'
)
do
f
=
Fiber
.
new
{
|
x
|
Fiber
.
yield
(
x
==
3
)}
f
=
Fiber
.
new
{
|
x
|
Fiber
.
yield
x
}
f
.
resume
(
3
)
assert_equal
3
,
f
.
resume
(
3
)
}
assert_true
f
.
alive?
end
assert
(
'FiberError'
)
do
assert
(
'FiberError'
)
do
assert_equal
StandardError
,
FiberError
.
superclass
assert_equal
StandardError
,
FiberError
.
superclass
end
end
assert
(
'Fiber iteration'
)
{
assert
(
'Fiber iteration'
)
do
f1
=
Fiber
.
new
{
f1
=
Fiber
.
new
{
[
1
,
2
,
3
].
each
{
|
x
|
Fiber
.
yield
(
x
)}
[
1
,
2
,
3
].
each
{
|
x
|
Fiber
.
yield
(
x
)}
}
}
...
@@ -72,8 +72,8 @@ assert('Fiber iteration') {
...
@@ -72,8 +72,8 @@ assert('Fiber iteration') {
a
<<
f1
.
resume
a
<<
f1
.
resume
a
<<
f2
.
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'
)
{
assert
(
'Fiber with splat in the block argument list'
)
{
Fiber
.
new
{
|*
x
|
x
}.
resume
(
1
)
==
[
1
]
Fiber
.
new
{
|*
x
|
x
}.
resume
(
1
)
==
[
1
]
...
...
mrbgems/mruby-proc-ext/test/proc.rb
View file @
6cf5618b
...
@@ -10,7 +10,7 @@ end
...
@@ -10,7 +10,7 @@ end
assert
(
'Proc#inspect'
)
do
assert
(
'Proc#inspect'
)
do
ins
=
Proc
.
new
{}.
inspect
ins
=
Proc
.
new
{}.
inspect
assert_
true
ins
.
kind_of?
String
assert_
kind_of
String
,
ins
end
end
assert
(
'Proc#lambda?'
)
do
assert
(
'Proc#lambda?'
)
do
...
...
test/t/enumerable.rb
View file @
6cf5618b
...
@@ -44,7 +44,7 @@ assert('Enumerable#collect', '15.3.2.2.3') do
...
@@ -44,7 +44,7 @@ assert('Enumerable#collect', '15.3.2.2.3') do
end
end
assert
(
'Enumerable#detect'
,
'15.3.2.2.4'
)
do
assert
(
'Enumerable#detect'
,
'15.3.2.2.4'
)
do
assert_
true
[
1
,
2
,
3
].
detect
()
{
true
}
assert_
equal
1
,
[
1
,
2
,
3
].
detect
()
{
true
}
assert_equal
'a'
,
[
1
,
2
,
3
].
detect
(
"a"
)
{
false
}
assert_equal
'a'
,
[
1
,
2
,
3
].
detect
(
"a"
)
{
false
}
end
end
...
@@ -63,7 +63,7 @@ assert('Enumerable#entries', '15.3.2.2.6') do
...
@@ -63,7 +63,7 @@ assert('Enumerable#entries', '15.3.2.2.6') do
end
end
assert
(
'Enumerable#find'
,
'15.3.2.2.7'
)
do
assert
(
'Enumerable#find'
,
'15.3.2.2.7'
)
do
assert_
true
[
1
,
2
,
3
].
find
()
{
true
}
assert_
equal
1
,
[
1
,
2
,
3
].
find
()
{
true
}
assert_equal
'a'
,
[
1
,
2
,
3
].
find
(
"a"
)
{
false
}
assert_equal
'a'
,
[
1
,
2
,
3
].
find
(
"a"
)
{
false
}
end
end
...
@@ -106,7 +106,7 @@ assert('Enumerable#member?', '15.3.2.2.15') do
...
@@ -106,7 +106,7 @@ assert('Enumerable#member?', '15.3.2.2.15') do
assert_false
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
].
member?
(
0
)
assert_false
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
].
member?
(
0
)
end
end
assert
(
'Enumerable#partion'
,
'15.3.2.2.16'
)
do
assert
(
'Enumerable#parti
ti
on'
,
'15.3.2.2.16'
)
do
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
].
partition
do
|
i
|
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
].
partition
do
|
i
|
i
%
2
==
0
i
%
2
==
0
end
==
[[
0
,
2
,
4
,
6
,
8
],
[
1
,
3
,
5
,
7
,
9
]]
end
==
[[
0
,
2
,
4
,
6
,
8
],
[
1
,
3
,
5
,
7
,
9
]]
...
...
test/t/exception.rb
View file @
6cf5618b
...
@@ -16,11 +16,14 @@ assert('Exception.exception', '15.2.22.4.1') do
...
@@ -16,11 +16,14 @@ assert('Exception.exception', '15.2.22.4.1') do
end
end
assert
(
'Exception#exception'
,
'15.2.22.5.1'
)
do
assert
(
'Exception#exception'
,
'15.2.22.5.1'
)
do
e1
=
Exception
.
exception
()
e
=
Exception
.
new
e2
=
Exception
.
exception
(
'b'
)
re
=
RuntimeError
.
new
assert_equal
e
,
e
.
exception
assert_equal
Exception
,
e1
.
class
assert_equal
e
,
e
.
exception
(
e
)
assert_equal
Exception
,
e2
.
class
assert_equal
re
,
re
.
exception
(
re
)
changed_re
=
re
.
exception
(
'message has changed'
)
assert_not_equal
re
,
changed_re
assert_equal
'message has changed'
,
changed_re
.
message
end
end
assert
(
'Exception#message'
,
'15.2.22.5.2'
)
do
assert
(
'Exception#message'
,
'15.2.22.5.2'
)
do
...
...
test/t/proc.rb
View file @
6cf5618b
...
@@ -26,8 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do
...
@@ -26,8 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
.
[
](
5
)
b2
.
[
](
5
)
assert_equal
a
,
1
assert_equal
1
,
a
assert_equal
a2
,
5
assert_equal
5
,
a2
end
end
assert
(
'Proc#arity'
,
'15.2.17.4.2'
)
do
assert
(
'Proc#arity'
,
'15.2.17.4.2'
)
do
...
...
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