summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/proc/fixtures')
-rw-r--r--spec/ruby/core/proc/fixtures/common.rb23
-rw-r--r--spec/ruby/core/proc/fixtures/proc_aref.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/proc_aref_frozen.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/source_location.rb8
4 files changed, 46 insertions, 5 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
new file mode 100644
index 0000000000..8ee355b14c
--- /dev/null
+++ b/spec/ruby/core/proc/fixtures/proc_aref.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: false
+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
new file mode 100644
index 0000000000..50a330ba4f
--- /dev/null
+++ b/spec/ruby/core/proc/fixtures/proc_aref_frozen.rb
@@ -0,0 +1,10 @@
+# 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/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