Skip to content

Commit 2a4e060

Browse files
committed
Stub enough Struct changes to load specs
1 parent fae78ea commit 2a4e060

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

spec/tags/core/struct/new_tags.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
fails:Struct.new overwrites previously defined constants with string as first argument
22
fails:Struct.new raises a ArgumentError if passed a Hash with an unknown key
33
fails:Struct.new keyword_init: false option behaves like it does without :keyword_init option
4+
fails:Struct.new keyword_init: true option creates a class that accepts keyword arguments to initialize
5+
fails:Struct.new keyword_init: true option new class instantiation accepts arguments as hash as well
6+
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed not declared keyword argument
7+
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed a list of arguments
8+
fails:Struct.new keyword_init: true option new class instantiation raises ArgumentError when passed a single non-hash argument

spec/truffle.mspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class MSpecScript
5858
set :core, [
5959
"spec/ruby/core",
6060

61-
"^spec/ruby/core/struct/new_spec.rb",
6261
"^spec/ruby/core/tracepoint",
6362
"^spec/ruby/core/dir/glob_spec.rb",
6463
"^spec/ruby/core/dir/element_reference_spec.rb"

src/main/ruby/core/struct.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class << self
3333
alias_method :subclass_new, :new
3434
end
3535

36-
def self.new(klass_name, *attrs, &block)
36+
def self.new(klass_name, *attrs, keyword_init: true, &block)
3737
if klass_name
3838
if klass_name.kind_of? Symbol # Truffle: added to avoid exception and match MRI
3939
attrs.unshift klass_name

0 commit comments

Comments
 (0)