mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
struct.c: show keyword_init: true
on inspect
for debugging if it's specified for the Struct class. This follows up r61137. We don't provide a method to check it because I don't think of any use case, but showing this to inspect would be helpful for debugging if someone is debugging whether keyword_init is properly enabled or not. In this commit, I didn't show `keyword_init: false` because of backward compatibility. Ideally any application should not depend on the behavior of inspect, but I don't have strong motivation to break it too. [close GH-1773] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1dcdb86876
commit
8411f58ed7
2 changed files with 13 additions and 0 deletions
|
@ -102,6 +102,8 @@ module TestStruct
|
|||
assert_raise(ArgumentError) { @Struct::KeywordInitTrue.new(1, b: 2) }
|
||||
assert_raise(ArgumentError) { @Struct::KeywordInitTrue.new(a: 1, b: 2, c: 3) }
|
||||
assert_equal @Struct::KeywordInitTrue.new(a: 1, b: 2).values, @Struct::KeywordInitFalse.new(1, 2).values
|
||||
assert_equal "#{@Struct}::KeywordInitFalse", @Struct::KeywordInitFalse.inspect
|
||||
assert_equal "#{@Struct}::KeywordInitTrue(keyword_init: true)", @Struct::KeywordInitTrue.inspect
|
||||
|
||||
@Struct.instance_eval do
|
||||
remove_const(:KeywordInitTrue)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue