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.rb9
-rw-r--r--spec/ruby/core/proc/fixtures/proc_aref_frozen.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/proc_call.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/proc_call_frozen.rb10
-rw-r--r--spec/ruby/core/proc/fixtures/source_location.rb2
6 files changed, 43 insertions, 21 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 688dac1e22..5572094630 100644
--- a/spec/ruby/core/proc/fixtures/source_location.rb
+++ b/spec/ruby/core/proc/fixtures/source_location.rb
@@ -44,7 +44,7 @@ module ProcSpecs
def self.my_detached_lambda
body = -> { true }
- lambda(&body)
+ suppress_warning {lambda(&body)}
end
def self.my_detached_proc_new