summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/fixtures
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/kernel/fixtures
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/kernel/fixtures')
-rw-r--r--spec/ruby/core/kernel/fixtures/classes.rb25
-rw-r--r--spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb2
2 files changed, 16 insertions, 11 deletions
diff --git a/spec/ruby/core/kernel/fixtures/classes.rb b/spec/ruby/core/kernel/fixtures/classes.rb
index 1f45bbb083..2909a621a9 100644
--- a/spec/ruby/core/kernel/fixtures/classes.rb
+++ b/spec/ruby/core/kernel/fixtures/classes.rb
@@ -328,7 +328,7 @@ module KernelSpecs
def inner
b = mp { return :good }
- pr = lambda { |x| x.call }
+ pr = -> x { x.call }
pr.call(b)
@@ -424,6 +424,20 @@ module KernelSpecs
def f2_call_lineno; method(:f3).source_location[1] + 1; end
def f3_call_lineno; method(:f4).source_location[1] + 1; end
end
+
+ CustomRangeInteger = Struct.new(:value) do
+ def to_int; value; end
+ def <=>(other); to_int <=> other.to_int; end
+ def -(other); self.class.new(to_int - other.to_int); end
+ def +(other); self.class.new(to_int + other.to_int); end
+ end
+
+ CustomRangeFloat = Struct.new(:value) do
+ def to_f; value; end
+ def <=>(other); to_f <=> other.to_f; end
+ def -(other); to_f - other.to_f; end
+ def +(other); self.class.new(to_f + other.to_f); end
+ end
end
class EvalSpecs
@@ -454,12 +468,3 @@ class EvalSpecs
return f
end
end
-
-# for Kernel#sleep to have Channel in it's specs
-# TODO: switch directly to queue for both Kernel#sleep and Thread specs?
-unless defined? Channel
- require 'thread'
- class Channel < Queue
- alias receive shift
- end
-end
diff --git a/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb b/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
index a48b5685f3..9e2d045bf3 100644
--- a/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
+++ b/spec/ruby/core/kernel/fixtures/eval_return_with_lambda.rb
@@ -1,5 +1,5 @@
print "a,"
-x = lambda do
+x = -> do
print "b,"
Proc.new do
print "c,"