Add tests and NEWS [Feature #18008]
This commit is contained in:
parent
1a63754416
commit
835c63cd88
2
NEWS.md
2
NEWS.md
@ -96,6 +96,8 @@ Outstanding ones only.
|
||||
You need to use a Hash literal to set a Hash to a first member.
|
||||
[[Feature #16806]]
|
||||
|
||||
* StructClass#keyword_init? is added [[Feature #18008]]
|
||||
|
||||
* Queue
|
||||
|
||||
* Queue#initialize now accepts an Enumerable of initial values.
|
||||
|
@ -138,6 +138,14 @@ module TestStruct
|
||||
assert_equal(3, struct.new(a: 1, b: 2).c)
|
||||
end
|
||||
|
||||
def test_struct_keyword_init_p
|
||||
struct = @Struct.new(:a, :b, keyword_init: true)
|
||||
assert_equal(true, struct.keyword_init?)
|
||||
|
||||
struct = @Struct.new(:a, :b, keyword_init: false)
|
||||
assert_equal(false, struct.keyword_init?)
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
klass = @Struct.new(:a)
|
||||
assert_raise(ArgumentError) { klass.new(1, 2) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user