mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Replace R-assignment by single-line pattern matching.
Since `R-assignment` in CRuby is abandoned. Single-line pattern matching in `mruby` only matches single local variable at the moment. Currently it works as a right assignment to a local variable. It will be enhanced in the future.
This commit is contained in:
+1
-5
@@ -345,13 +345,9 @@ assert('splat object in assignment') do
|
||||
assert_equal [2], (a = *o)
|
||||
end
|
||||
|
||||
assert('right-ward assignment') do
|
||||
assert('one-line pattern match') do
|
||||
1 => a
|
||||
assert_equal(1, a)
|
||||
13.divmod(5) => a,b
|
||||
assert_equal([2,3], [a, b])
|
||||
13.divmod(5) => a,b => c, d
|
||||
assert_equal([2,3,2,3], [a, b, c, d])
|
||||
end
|
||||
|
||||
assert('splat object in case statement') do
|
||||
|
||||
Reference in New Issue
Block a user