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
3f83ec64
Commit
3f83ec64
authored
Dec 01, 2016
by
Yutaka HARA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for recently fixed bugs
parent
61ac564c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
test/t/array.rb
test/t/array.rb
+13
-0
test/t/class.rb
test/t/class.rb
+12
-0
test/t/hash.rb
test/t/hash.rb
+7
-0
test/t/syntax.rb
test/t/syntax.rb
+20
-0
No files found.
test/t/array.rb
View file @
3f83ec64
...
@@ -82,6 +82,14 @@ assert('Array#[]=', '15.2.12.5.5') do
...
@@ -82,6 +82,14 @@ assert('Array#[]=', '15.2.12.5.5') do
a
=
[
1
,
2
,
3
,
4
,
5
]
a
=
[
1
,
2
,
3
,
4
,
5
]
a
[
2
...
4
]
=
6
a
[
2
...
4
]
=
6
assert_equal
([
1
,
2
,
6
,
5
],
a
)
assert_equal
([
1
,
2
,
6
,
5
],
a
)
# passing self (#3274)
a
=
[
1
,
2
,
3
]
a
[
1
,
0
]
=
a
assert_equal
([
1
,
1
,
2
,
3
,
2
,
3
],
a
)
a
=
[
1
,
2
,
3
]
a
[
-
1
,
0
]
=
a
assert_equal
([
1
,
2
,
1
,
2
,
3
,
3
],
a
)
end
end
assert
(
'Array#clear'
,
'15.2.12.5.6'
)
do
assert
(
'Array#clear'
,
'15.2.12.5.6'
)
do
...
@@ -98,6 +106,11 @@ end
...
@@ -98,6 +106,11 @@ end
assert
(
'Array#concat'
,
'15.2.12.5.8'
)
do
assert
(
'Array#concat'
,
'15.2.12.5.8'
)
do
assert_equal
([
1
,
2
,
3
,
4
],
[
1
,
2
].
concat
([
3
,
4
]))
assert_equal
([
1
,
2
,
3
,
4
],
[
1
,
2
].
concat
([
3
,
4
]))
# passing self (#3302)
a
=
[
1
,
2
,
3
]
a
.
concat
(
a
)
assert_equal
([
1
,
2
,
3
,
1
,
2
,
3
],
a
)
end
end
assert
(
'Array#delete_at'
,
'15.2.12.5.9'
)
do
assert
(
'Array#delete_at'
,
'15.2.12.5.9'
)
do
...
...
test/t/class.rb
View file @
3f83ec64
...
@@ -397,6 +397,18 @@ assert('class variable in module and class << self style class method') do
...
@@ -397,6 +397,18 @@ assert('class variable in module and class << self style class method') do
assert_equal
(
"value"
,
ClassVariableInModuleTest
.
class_variable
)
assert_equal
(
"value"
,
ClassVariableInModuleTest
.
class_variable
)
end
end
assert
(
'overriding class variable with a module (#3235)'
)
do
module
ModuleWithCVar
@@class_variable
=
1
end
class
CVarOverrideTest
@@class_variable
=
2
include
ModuleWithCVar
assert_equal
(
1
,
@@class_variable
)
end
end
assert
(
'class with non-class/module outer raises TypeError'
)
do
assert
(
'class with non-class/module outer raises TypeError'
)
do
assert_raise
(
TypeError
)
{
class
0::C1
;
end
}
assert_raise
(
TypeError
)
{
class
0::C1
;
end
}
assert_raise
(
TypeError
)
{
class
[]
::
C2
;
end
}
assert_raise
(
TypeError
)
{
class
[]
::
C2
;
end
}
...
...
test/t/hash.rb
View file @
3f83ec64
...
@@ -16,6 +16,13 @@ assert('Hash#[]', '15.2.13.4.2') do
...
@@ -16,6 +16,13 @@ assert('Hash#[]', '15.2.13.4.2') do
a
=
{
'abc'
=>
'abc'
}
a
=
{
'abc'
=>
'abc'
}
assert_equal
'abc'
,
a
[
'abc'
]
assert_equal
'abc'
,
a
[
'abc'
]
# Hash#[] should call #default (#3272)
hash
=
{}
def
hash
.
default
(
k
);
self
[
k
]
=
1
;
end
hash
[
:foo
]
+=
1
assert_equal
2
,
hash
[
:foo
]
end
end
assert
(
'Hash#[]='
,
'15.2.13.4.3'
)
do
assert
(
'Hash#[]='
,
'15.2.13.4.3'
)
do
...
...
test/t/syntax.rb
View file @
3f83ec64
...
@@ -47,6 +47,19 @@ assert('yield', '11.3.5') do
...
@@ -47,6 +47,19 @@ assert('yield', '11.3.5') do
end
end
end
end
assert
(
'redo in a for loop (#3275)'
)
do
sum
=
0
for
i
in
1
..
10
sum
+=
i
i
-=
1
if
i
>
0
redo
end
end
assert_equal
220
,
sum
end
assert
(
'Abbreviated variable assignment'
,
'11.4.2.3.2'
)
do
assert
(
'Abbreviated variable assignment'
,
'11.4.2.3.2'
)
do
a
||=
1
a
||=
1
b
&&=
1
b
&&=
1
...
@@ -255,6 +268,13 @@ assert('multiple assignment (nosplat array rhs)') do
...
@@ -255,6 +268,13 @@ assert('multiple assignment (nosplat array rhs)') do
assert_equal
2
,
g
assert_equal
2
,
g
end
end
assert
(
'multiple assignment (empty array rhs #3236, #3239)'
)
do
a
,
b
,
*
c
=
[];
assert_equal
[
nil
,
nil
,
[]],
[
a
,
b
,
c
]
a
,
b
,
*
c
=
[
1
];
assert_equal
[
1
,
nil
,
[]],
[
a
,
b
,
c
]
a
,
b
,
*
c
=
[
nil
];
assert_equal
[
nil
,
nil
,
[]],
[
a
,
b
,
c
]
a
,
b
,
*
c
=
[[]];
assert_equal
[[],
nil
,
[]],
[
a
,
b
,
c
]
end
assert
(
'Return values of case statements'
)
do
assert
(
'Return values of case statements'
)
do
a
=
[]
<<
case
1
a
=
[]
<<
case
1
when
3
then
2
when
3
then
2
...
...
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