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
99aff170
Commit
99aff170
authored
Jul 11, 2015
by
Corey Powell
Committed by
Blaž Hrastnik
Jul 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ported a bit more of the MRI Module#prepend tests over
Currently kind_of fails miserably, still looking for the reason
parent
d4b009b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
26 deletions
+68
-26
test/t/module.rb
test/t/module.rb
+68
-26
No files found.
test/t/module.rb
View file @
99aff170
...
@@ -474,38 +474,80 @@ end
...
@@ -474,38 +474,80 @@ end
# Not ISO specified
# Not ISO specified
# @!group prepend
assert
(
'Module#prepend'
)
do
assert
(
'Module#prepend'
)
do
module
M0
assert
(
'test_prepend'
)
do
def
m1
;
[
:M0
]
end
module
M0
end
def
m1
;
[
:M0
]
end
module
M1
end
def
m1
;
[
:M1
,
super
,
:M1
]
end
module
M1
end
def
m1
;
[
:M1
,
super
,
:M1
]
end
module
M2
end
def
m1
;
[
:M2
,
super
,
:M2
]
end
module
M2
end
def
m1
;
[
:M2
,
super
,
:M2
]
end
M3
=
Module
.
new
do
end
def
m1
;
[
:M3
,
super
,
:M3
]
end
M3
=
Module
.
new
do
end
def
m1
;
[
:M3
,
super
,
:M3
]
end
module
M4
end
def
m1
;
[
:M4
,
super
,
:M4
]
end
module
M4
end
def
m1
;
[
:M4
,
super
,
:M4
]
end
end
class
P0
class
P0
include
M0
include
M0
prepend
M1
prepend
M1
def
m1
;
[
:C0
,
super
,
:C0
]
end
def
m1
;
[
:C0
,
super
,
:C0
]
end
end
class
P1
<
P0
prepend
M2
,
M3
include
M4
def
m1
;
[
:C1
,
super
,
:C1
]
end
end
obj
=
P1
.
new
expected
=
[
:M2
,[
:M3
,[
:C1
,[
:M4
,[
:M1
,[
:C0
,[
:M0
],
:C0
],
:M1
],
:M4
],
:C1
],
:M3
],
:M2
]
assert_equal
(
expected
,
obj
.
m1
)
end
end
class
P1
<
P0
prepend
M2
,
M3
# mruby shouldn't be affected by this since there is
include
M4
# no visibility control (yet)
def
m1
;
[
:C1
,
super
,
:C1
]
end
assert
(
'test_public_prepend'
)
do
assert_nothing_raised
(
'ruby/ruby #8846'
)
do
Class
.
new
.
prepend
(
Module
.
new
)
end
end
end
obj
=
P1
.
new
assert
(
'test_prepend_inheritance'
)
do
expected
=
[
:M2
,[
:M3
,[
:C1
,[
:M4
,[
:M1
,[
:C0
,[
:M0
],
:C0
],
:M1
],
:M4
],
:C1
],
:M3
],
:M2
]
bug6654
=
'[ruby-core:45914]'
assert_equal
(
expected
,
obj
.
m1
)
a
=
Module
.
new
b
=
Module
.
new
{
include
a
}
c
=
Module
.
new
{
prepend
b
}
assert
bug6654
do
# the Module#< operator should be used here instead, but we don't have it
assert_include
(
c
.
ancestors
,
a
)
assert_include
(
c
.
ancestors
,
b
)
end
bug8357
=
'[ruby-core:54736] [Bug #8357]'
b
=
Module
.
new
{
prepend
a
}
c
=
Class
.
new
{
include
b
}
assert
bug8357
do
# the Module#< operator should be used here instead, but we don't have it
assert_include
(
c
.
ancestors
,
a
)
assert_include
(
c
.
ancestors
,
b
)
end
bug8357
=
'[ruby-core:54742] [Bug #8357]'
t_print
c
.
new
.
kind_of?
(
b
)
t_print
"
\n
"
t_print
[
b
,
b
.
ancestors
,
c
,
c
.
ancestors
].
inspect
t_print
"
\n
"
assert_kind_of
(
b
,
c
.
new
,
bug8357
)
end
end
end
# @!endgroup prepend
assert
(
'Module#to_s'
)
do
assert
(
'Module#to_s'
)
do
module
Test4to_sModules
module
Test4to_sModules
...
...
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