diff options
Diffstat (limited to 'spec/ruby/core/proc/fixtures')
| -rw-r--r-- | spec/ruby/core/proc/fixtures/common.rb | 23 | ||||
| -rw-r--r-- | spec/ruby/core/proc/fixtures/proc_aref.rb | 9 | ||||
| -rw-r--r-- | spec/ruby/core/proc/fixtures/proc_aref_frozen.rb | 10 | ||||
| -rw-r--r-- | spec/ruby/core/proc/fixtures/proc_call.rb | 10 | ||||
| -rw-r--r-- | spec/ruby/core/proc/fixtures/proc_call_frozen.rb | 10 | ||||
| -rw-r--r-- | spec/ruby/core/proc/fixtures/source_location.rb | 8 |
6 files changed, 46 insertions, 24 deletions
diff --git a/spec/ruby/core/proc/fixtures/common.rb b/spec/ruby/core/proc/fixtures/common.rb index 6e27a2dee7..dfe67d7ba8 100644 --- a/spec/ruby/core/proc/fixtures/common.rb +++ b/spec/ruby/core/proc/fixtures/common.rb @@ -32,7 +32,28 @@ module ProcSpecs @second = b end - attr_reader :first, :second + attr_reader :first, :second, :initializer + + def initialize_copy(other) + super + @initializer = :copy + @first = other.first + @second = other.second + end + + def initialize_dup(other) + super + @initializer = :dup + @first = other.first + @second = other.second + end + + def initialize_clone(other, **options) + super + @initializer = :clone + @first = other.first + @second = other.second + end end class Arity diff --git a/spec/ruby/core/proc/fixtures/proc_aref.rb b/spec/ruby/core/proc/fixtures/proc_aref.rb deleted file mode 100644 index a305667797..0000000000 --- a/spec/ruby/core/proc/fixtures/proc_aref.rb +++ /dev/null @@ -1,9 +0,0 @@ -module ProcArefSpecs - def self.aref - proc {|a| a }["sometext"] - end - - def self.aref_freeze - proc {|a| a }["sometext".freeze] - end -end diff --git a/spec/ruby/core/proc/fixtures/proc_aref_frozen.rb b/spec/ruby/core/proc/fixtures/proc_aref_frozen.rb deleted file mode 100644 index 50a330ba4f..0000000000 --- a/spec/ruby/core/proc/fixtures/proc_aref_frozen.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -module ProcArefFrozenSpecs - def self.aref - proc {|a| a }["sometext"] - end - - def self.aref_freeze - proc {|a| a }["sometext".freeze] - end -end diff --git a/spec/ruby/core/proc/fixtures/proc_call.rb b/spec/ruby/core/proc/fixtures/proc_call.rb new file mode 100644 index 0000000000..32048f5319 --- /dev/null +++ b/spec/ruby/core/proc/fixtures/proc_call.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: false +module ProcCallSpecs + def self.call + proc {|a| a }.call("sometext") + end + + def self.call_freeze + proc {|a| a }.call("sometext".freeze) + end +end diff --git a/spec/ruby/core/proc/fixtures/proc_call_frozen.rb b/spec/ruby/core/proc/fixtures/proc_call_frozen.rb new file mode 100644 index 0000000000..29ffc3c4c9 --- /dev/null +++ b/spec/ruby/core/proc/fixtures/proc_call_frozen.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true +module ProcCallFrozenSpecs + def self.call + proc {|a| a }.call("sometext") + end + + def self.call_freeze + proc {|a| a }.call("sometext".freeze) + end +end diff --git a/spec/ruby/core/proc/fixtures/source_location.rb b/spec/ruby/core/proc/fixtures/source_location.rb index 468262e02a..5572094630 100644 --- a/spec/ruby/core/proc/fixtures/source_location.rb +++ b/spec/ruby/core/proc/fixtures/source_location.rb @@ -5,7 +5,7 @@ module ProcSpecs end def self.my_lambda - lambda { true } + -> { true } end def self.my_proc_new @@ -24,7 +24,7 @@ module ProcSpecs end def self.my_multiline_lambda - lambda do + -> do 'a'.upcase 1 + 22 end @@ -43,8 +43,8 @@ module ProcSpecs end def self.my_detached_lambda - body = lambda { true } - lambda(&body) + body = -> { true } + suppress_warning {lambda(&body)} end def self.my_detached_proc_new |
