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
5c2afd23
Commit
5c2afd23
authored
Sep 30, 2012
by
Akira Kuroda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test case for Array#unshift, <=>, and *
parent
be8f3909
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
test/t/array.rb
test/t/array.rb
+16
-3
No files found.
test/t/array.rb
View file @
5c2afd23
...
...
@@ -14,7 +14,17 @@ assert('Array.[]', '15.2.12.4.1') do
end
assert
(
'Array#*'
,
'15.2.12.5.1'
)
do
[
1
].
*
(
3
)
==
[
1
,
1
,
1
]
e2
=
nil
begin
# this will cause an exception due to the wrong argument
[
1
].
*
(
-
1
)
rescue
=>
e1
e2
=
e1
end
a
=
[
1
].
*
(
3
)
b
=
[
1
].
*
(
0
)
a
==
[
1
,
1
,
1
]
and
b
==
[]
and
e2
.
class
==
ArgumentError
end
assert
(
'Array#+'
,
'15.2.12.5.2'
)
do
...
...
@@ -256,8 +266,10 @@ end
assert
(
'Array#unshift'
,
'15.2.12.5.30'
)
do
a
=
[
2
,
3
]
b
=
a
.
unshift
(
1
)
c
=
[
2
,
3
]
d
=
c
.
unshift
(
0
,
1
)
a
==
[
1
,
2
,
3
]
and
b
==
[
1
,
2
,
3
]
a
==
[
1
,
2
,
3
]
and
b
==
[
1
,
2
,
3
]
and
c
==
[
0
,
1
,
2
,
3
]
and
d
==
[
0
,
1
,
2
,
3
]
end
assert
(
'Array#to_s'
,
'15.2.12.5.31'
)
do
...
...
@@ -279,8 +291,9 @@ end
assert
(
'Array#<=>'
,
'15.2.12.5.36'
)
do
r1
=
[
"a"
,
"a"
,
"c"
]
<=>
[
"a"
,
"b"
,
"c"
]
#=> -1
r2
=
[
1
,
2
,
3
,
4
,
5
,
6
]
<=>
[
1
,
2
]
#=> +1
r3
=
[
"a"
,
"b"
,
"c"
]
<=>
[
"a"
,
"b"
,
"c"
]
#=> 0
r1
==
-
1
and
r2
==
+
1
r1
==
-
1
and
r2
==
+
1
and
r3
==
0
end
# Not ISO specified
...
...
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