summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-07-15 07:27:48 +0900
committerGitHub <[email protected]>2021-07-15 07:27:48 +0900
commitb8863c69dccce97f6fae178552afc61ba0b07f0c (patch)
tree4c8bd0cf08383221a8da6d193daa0f8e3fcfc782
parentf5eeb76a85642f5277424770e59bb1a3edf6a989 (diff)
parent7c527342436308469041406aa558c0ac1e47a9fe (diff)
downloadmruby-b8863c69dccce97f6fae178552afc61ba0b07f0c.tar.gz
mruby-b8863c69dccce97f6fae178552afc61ba0b07f0c.zip
Merge pull request #4141 from udzura/add-test-for-attr-nil-guard
Add a testcase of #4137 fix
-rw-r--r--test/t/syntax.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index c5c677b3f..c4c99242b 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -188,6 +188,18 @@ assert('Abbreviated variable assignment as returns') do
assert_equal 1, Syntax4AbbrVarAsgnAsReturns::A.new.b
end
+assert('Abbreviated variable assignment of object attribute') do
+ module Syntax4AbbrVarAsgnObjectAttr
+ class A
+ attr_accessor :c
+ def b
+ self.c ||= 1
+ end
+ end
+ end
+ assert_equal 1, Syntax4AbbrVarAsgnObjectAttr::A.new.b
+end
+
assert('Splat and multiple assignment') do
*a = *[1,2,3]
b, *c = *[7,8,9]