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
882bc80d
Commit
882bc80d
authored
5 years ago
by
KOBAYASHI Shuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for #4746
parent
3d278131
master
removing-y-tab-c
revert-5391-throw
stable
3.1.0-rc
3.0.0
3.0.0-rc
3.0.0-preview
2.1.2
2.1.2-rc2
2.1.2-rc
2.1.1
2.1.1-rc2
2.1.1-rc
2.1.0
2.1.0-rc
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
test/t/syntax.rb
test/t/syntax.rb
+16
-0
No files found.
test/t/syntax.rb
View file @
882bc80d
...
...
@@ -451,6 +451,18 @@ assert('optional block argument in the rhs default expressions') do
assert_nil
(
Proc
.
new
{
|
foo
=
foo
|
foo
}.
call
)
end
assert
(
'local variable definition in default value and subsequent arguments'
)
do
def
m
(
a
=
b
=
1
,
c
)
[
a
,
b
,
c
]
end
assert_equal
([
1
,
1
,
:c
],
m
(
:c
))
assert_equal
([
:a
,
nil
,
:c
],
m
(
:a
,
:c
))
def
m
(
a
=
b
=
1
,
&
c
)
[
a
,
b
,
c
?
true
:
nil
]
end
assert_equal
([
1
,
1
,
nil
],
m
)
assert_equal
([
1
,
1
,
true
],
m
{})
assert_equal
([
:a
,
nil
,
nil
],
m
(
:a
))
assert_equal
([
:a
,
nil
,
true
],
m
(
:a
){})
end
assert
(
'multiline comments work correctly'
)
do
=begin
this is a comment with nothing after begin and end
...
...
@@ -654,4 +666,8 @@ assert 'keyword arguments' do
result = m(1, 2, e: 3, g: 4, h: 5, i: 6, &(l = ->{}))
assert_equal([1, 1, [], 2, 3, 2, 4, { h: 5, i: 6 }, l], result)
=end
def
m
(
a:
b
=
1
,
c
:)
[
a
,
b
,
c
]
end
assert_equal
([
1
,
1
,
:c
],
m
(
c: :c
))
assert_equal
([
:a
,
nil
,
:c
],
m
(
a: :a
,
c: :c
))
end
This diff is collapsed.
Click to expand it.
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