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
fc20d018
Commit
fc20d018
authored
Jan 03, 2019
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for #<< and #>> for Proc and Method class
parent
9a9e12a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
mrbgems/mruby-method/test/method.rb
mrbgems/mruby-method/test/method.rb
+19
-0
mrbgems/mruby-proc-ext/test/proc.rb
mrbgems/mruby-proc-ext/test/proc.rb
+13
-0
No files found.
mrbgems/mruby-method/test/method.rb
View file @
fc20d018
...
@@ -371,6 +371,25 @@ assert "Method#initialize_copy" do
...
@@ -371,6 +371,25 @@ assert "Method#initialize_copy" do
assert_equal
(
m1
,
m2
)
assert_equal
(
m1
,
m2
)
end
end
assert
"Method#<< and Method#>>"
do
obj
=
Object
.
new
class
<<
obj
def
mul2
(
n
);
n
*
2
;
end
def
add3
(
n
);
n
+
3
;
end
end
f
=
obj
.
method
(
:mul2
)
g
=
obj
.
method
(
:add3
)
m1
=
f
<<
g
assert_kind_of
Proc
,
m1
assert_equal
16
,
m1
.
call
(
5
)
m2
=
f
>>
g
assert_kind_of
Proc
,
m2
assert_equal
13
,
m2
.
call
(
5
)
end
assert
'UnboundMethod#arity'
do
assert
'UnboundMethod#arity'
do
c
=
Class
.
new
{
c
=
Class
.
new
{
def
foo
(
a
,
b
)
def
foo
(
a
,
b
)
...
...
mrbgems/mruby-proc-ext/test/proc.rb
View file @
fc20d018
...
@@ -77,6 +77,19 @@ assert('Kernel#proc') do
...
@@ -77,6 +77,19 @@ assert('Kernel#proc') do
end
end
end
end
assert
"Proc#<< and Proc#>>"
do
add3
=
->
(
n
)
{
n
+
3
}
mul2
=
->
(
n
)
{
n
*
2
}
f1
=
mul2
<<
add3
assert_kind_of
Proc
,
f1
assert_equal
16
,
f1
.
call
(
5
)
f2
=
mul2
>>
add3
assert_kind_of
Proc
,
f2
assert_equal
13
,
f2
.
call
(
5
)
end
assert
(
'mrb_proc_new_cfunc_with_env'
)
do
assert
(
'mrb_proc_new_cfunc_with_env'
)
do
ProcExtTest
.
mrb_proc_new_cfunc_with_env
(
:test
)
ProcExtTest
.
mrb_proc_new_cfunc_with_env
(
:test
)
ProcExtTest
.
mrb_proc_new_cfunc_with_env
(
:mruby
)
ProcExtTest
.
mrb_proc_new_cfunc_with_env
(
:mruby
)
...
...
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