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
65f6b105
Commit
65f6b105
authored
Jan 07, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:mruby/mruby
parents
7d8a3b61
8d01c157
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
test/t/syntax.rb
test/t/syntax.rb
+92
-0
No files found.
test/t/syntax.rb
View file @
65f6b105
...
...
@@ -42,6 +42,98 @@ assert('Abbreviated variable assignment', '11.4.2.3.2') do
assert_equal
3
,
c
end
assert
(
'case expression'
,
'11.5.2.2.4'
)
do
# case-expression-with-expression, one when-clause
x
=
0
case
"a"
when
"a"
x
=
1
end
assert_equal
1
,
x
# case-expression-with-expression, multiple when-clauses
x
=
0
case
"b"
when
"a"
x
=
1
when
"b"
x
=
2
end
assert_equal
2
,
x
# no matching when-clause
x
=
0
case
"c"
when
"a"
x
=
1
when
"b"
x
=
2
end
assert_equal
0
,
x
# case-expression-with-expression, one when-clause and one else-clause
a
=
0
case
"c"
when
"a"
x
=
1
else
x
=
3
end
assert_equal
3
,
x
# case-expression-without-expression, one when-clause
x
=
0
case
when
true
x
=
1
end
assert_equal
1
,
x
# case-expression-without-expression, multiple when-clauses
x
=
0
case
when
0
==
1
x
=
1
when
1
==
1
x
=
2
end
assert_equal
2
,
x
# case-expression-without-expression, one when-clause and one else-clause
x
=
0
case
when
0
==
1
x
=
1
else
x
=
3
end
assert_equal
3
,
x
# multiple when-arguments
x
=
0
case
4
when
1
,
3
,
5
x
=
1
when
2
,
4
,
6
x
=
2
end
assert_equal
2
,
x
# when-argument with splatting argument
x
=
:integer
odds
=
[
1
,
3
,
5
,
7
,
9
]
evens
=
[
2
,
4
,
6
,
8
]
case
5
when
*
odds
x
=
:odd
when
*
evens
x
=
:even
end
assert_equal
:odd
,
x
true
end
assert
(
'Nested const reference'
)
do
module
Syntax4Const
CONST1
=
"hello world"
...
...
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