Skip to content

Instantly share code, notes, and snippets.

@ko1

ko1/tests.patch Secret

Created Jan 22, 2019
Embed
What would you like to do?
Index: lib/optparse.rb
===================================================================
--- lib/optparse.rb (リビジョン 66834)
+++ lib/optparse.rb (作業コピー)
@@ -695,7 +695,7 @@
#
# Raises an exception if argument is not present.
#
- def parse(arg, argv)
+ def parse(arg, argv, &dummy)
unless arg
raise MissingArgument if argv.empty?
arg = argv.shift
Index: lib/rss/maker/base.rb
===================================================================
--- lib/rss/maker/base.rb (リビジョン 66834)
+++ lib/rss/maker/base.rb (作業コピー)
@@ -126,7 +126,7 @@
new_value_variable_name)
end
module_eval(<<-EOC, __FILE__, __LINE__ + 1)
- def #{name}
+ def #{name} &b
#{local_variable_name} = #{plural_name}.first
#{local_variable_name} ? #{local_variable_name}.#{attribute} : nil
end
@@ -535,7 +535,7 @@
self.date = date
end
- def updated
+ def updated &dummy
date
end
@@ -743,7 +743,7 @@
self.date = date
end
- def updated
+ def updated &dummy
date
end
@@ -821,7 +821,7 @@
@date = _parse_date_if_needed(_date)
end
- def updated
+ def updated &dummy
date
end
Index: lib/rubygems/package/tar_reader.rb
===================================================================
--- lib/rubygems/package/tar_reader.rb (リビジョン 66834)
+++ lib/rubygems/package/tar_reader.rb (作業コピー)
@@ -21,7 +21,7 @@
# Creates a new TarReader on +io+ and yields it to the block, if given.
def self.new(io)
- reader = super
+ reader = super(io, &nil)
return reader unless block_given?
Index: lib/rubygems/package/tar_writer.rb
===================================================================
--- lib/rubygems/package/tar_writer.rb (リビジョン 66834)
+++ lib/rubygems/package/tar_writer.rb (作業コピー)
@@ -78,7 +78,7 @@
# Creates a new TarWriter, yielding it if a block is given
def self.new(io)
- writer = super
+ writer = super(io, &nil)
return writer unless block_given?
Index: lib/weakref.rb
===================================================================
--- lib/weakref.rb (リビジョン 66834)
+++ lib/weakref.rb (作業コピー)
@@ -45,7 +45,10 @@
def __getobj__ # :nodoc:
@@__map[self] or defined?(@delegate_sd_obj) ? @delegate_sd_obj :
+ begin
+ yield if block_given?
Kernel::raise(RefError, "Invalid Reference - probably recycled", Kernel::caller(2))
+ end
end
def __setobj__(obj) # :nodoc:
Index: test/psych/visitors/test_yaml_tree.rb
===================================================================
--- test/psych/visitors/test_yaml_tree.rb (リビジョン 66834)
+++ test/psych/visitors/test_yaml_tree.rb (作業コピー)
@@ -7,7 +7,7 @@
class TestDelegatorClass < Delegator
def initialize(obj); super; @obj = obj; end
def __setobj__(obj); @obj = obj; end
- def __getobj__; @obj; end
+ def __getobj__ &dummy; @obj; end
end
class TestSimpleDelegatorClass < SimpleDelegator
Index: test/ruby/test_enum.rb
===================================================================
--- test/ruby/test_enum.rb (リビジョン 66834)
+++ test/ruby/test_enum.rb (作業コピー)
@@ -118,7 +118,7 @@
sym = Object.new
class << sym
include Enumerable
- def each
+ def each &dummy
self
end
@@ -133,7 +133,7 @@
inf = Object.new
class << inf
include Enumerable
- def each
+ def each &dummy
self
end
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb (リビジョン 66834)
+++ test/ruby/test_exception.rb (作業コピー)
@@ -568,7 +568,7 @@
assert_equal(false, s.tainted?)
end
- def m
+ def m &dummy
m(&->{return 0})
42
end
Index: test/ruby/test_iterator.rb
===================================================================
--- test/ruby/test_iterator.rb (リビジョン 66834)
+++ test/ruby/test_iterator.rb (作業コピー)
@@ -12,7 +12,7 @@
end
class TestIterator < Test::Unit::TestCase
- def ttt
+ def ttt &block
assert(iterator?)
end
@@ -167,15 +167,15 @@
IterTest.new([[8,8]]).each8 {|*x| assert_equal([[8,8]], x)}
end
- def m(var)
+ def m(var, &dummy)
var
end
- def m1
+ def m1 &dummy
m(block_given?)
end
- def m2
+ def m2 &dummy
m(block_given?,&proc{})
end
@@ -289,7 +289,7 @@
def proc_call(&b)
b.call
end
- def proc_call2(b)
+ def proc_call2(b, &dummy)
b.call
end
def proc_yield()
Index: test/ruby/test_keyword.rb
===================================================================
--- test/ruby/test_keyword.rb (リビジョン 66834)
+++ test/ruby/test_keyword.rb (作業コピー)
@@ -577,7 +577,7 @@
def bar(k2: 'v2')
end
- def foo
+ def foo &dummy
bar(k1: 1)
end
end
Index: test/ruby/test_lambda.rb
===================================================================
--- test/ruby/test_lambda.rb (リビジョン 66834)
+++ test/ruby/test_lambda.rb (作業コピー)
@@ -107,7 +107,7 @@
end
end
- def foo
+ def foo &dummy
assert_equal(nil, ->(&b){ b }.call)
end
Index: test/ruby/test_optimization.rb
===================================================================
--- test/ruby/test_optimization.rb (リビジョン 66834)
+++ test/ruby/test_optimization.rb (作業コピー)
@@ -452,11 +452,11 @@
end
class Bug10557
- def [](_)
+ def [](_,&dummy)
block_given?
end
- def []=(_, _)
+ def []=(_, _, &dummy)
block_given?
end
end
@@ -478,7 +478,7 @@
begin;
class String
undef freeze
- def freeze
+ def freeze &dummy
block_given?
end
end
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb (リビジョン 66834)
+++ test/ruby/test_proc.rb (作業コピー)
@@ -53,9 +53,9 @@
assert_equal(5, x)
end
- def assert_arity(n)
+ def assert_arity(n, &b)
meta = class << self; self; end
- meta.class_eval {define_method(:foo, Proc.new)}
+ meta.class_eval {define_method(:foo, b)}
assert_equal(n, method(:foo).arity)
end
@@ -202,7 +202,7 @@
var
end
- def m_block_given?
+ def m_block_given? &dummy
m1(block_given?)
end
@@ -1409,14 +1409,18 @@
end;
end
- def method_for_test_proc_without_block_for_symbol
- binding.eval('proc')
- end
+ # obsolete feature
+ # (1) proc without block is obsolete.
+ # (1) access block via eval frame will not be allowed.
+ #
+ #def method_for_test_proc_without_block_for_symbol
+ # binding.eval('proc')
+ #end
+ #
+ #def test_proc_without_block_for_symbol
+ # assert_equal('1', method_for_test_proc_without_block_for_symbol(&:to_s).call(1), '[Bug #14782]')
+ #end
- def test_proc_without_block_for_symbol
- assert_equal('1', method_for_test_proc_without_block_for_symbol(&:to_s).call(1), '[Bug #14782]')
- end
-
def test_compose
f = proc {|x| x * 2}
g = proc {|x| x + 1}
Index: test/ruby/test_symbol.rb
===================================================================
--- test/ruby/test_symbol.rb (リビジョン 66834)
+++ test/ruby/test_symbol.rb (作業コピー)
@@ -251,7 +251,7 @@
assert_raise(ArgumentError) { :foo.to_proc.call }
end
- def m_block_given?
+ def m_block_given? &dummy
block_given?
end
Index: test/ruby/test_thread.rb
===================================================================
--- test/ruby/test_thread.rb (リビジョン 66834)
+++ test/ruby/test_thread.rb (作業コピー)
@@ -1289,7 +1289,7 @@
end
end
assert_raise_with_message(ThreadError, /C\u{30b9 30ec 30c3 30c9}/) do
- t.new {}
+ t.new
end
end
Index: test/test_timeout.rb
===================================================================
--- test/test_timeout.rb (リビジョン 66834)
+++ test/test_timeout.rb (作業コピー)
@@ -83,7 +83,7 @@
def test_enumerator_next
bug9380 = '[ruby-dev:47872] [Bug #9380]: timeout in Enumerator#next'
e = (o=Object.new).to_enum
- def o.each
+ def o.each &dummy
sleep
end
assert_raise_with_message(Timeout::Error, 'execution expired', bug9380) do
Index: bootstraptest/test_block.rb
===================================================================
--- bootstraptest/test_block.rb (リビジョン 66834)
+++ bootstraptest/test_block.rb (作業コピー)
@@ -337,7 +337,7 @@
}
assert_equal '0', %q{
-def m()
+def m(&dummy)
end
m {|(v0,*,(*)),|}
m {|(*v0,(*)),|}
Index: bootstraptest/test_method.rb
===================================================================
--- bootstraptest/test_method.rb (リビジョン 66834)
+++ bootstraptest/test_method.rb (作業コピー)
@@ -404,7 +404,7 @@
# aset and splat
assert_equal '4', %q{class Foo;def []=(a,b,c,d);end;end;Foo.new[1,*a=[2,3]]=4}
-assert_equal '4', %q{class Foo;def []=(a,b,c,d);end;end;def m(&blk)Foo.new[1,*a=[2,3],&blk]=4;end;m{}}
+assert_equal '4', %q{class Foo;def []=(a,b,c,d,&dummy);end;end;def m(&blk)Foo.new[1,*a=[2,3],&blk]=4;end;m{}}
# post test
assert_equal %q{[1, 2, :o1, :o2, [], 3, 4, NilClass, nil, nil]}, %q{
@@ -977,7 +977,7 @@
}
}
end
- def bar
+ def bar &dummy
D.module_eval{
define_method(:m2){
block_given?
Index: bootstraptest/test_proc.rb
===================================================================
--- bootstraptest/test_proc.rb (リビジョン 66834)
+++ bootstraptest/test_proc.rb (作業コピー)
@@ -380,7 +380,7 @@
assert_equal 'ok', %q{
class Foo
- def call_it
+ def call_it &block
p = Proc.new
p.call
end
@@ -397,16 +397,16 @@
assert_equal 'foo!', %q{
class FooProc < Proc
- def initialize
+ def initialize &dummy
@foo = "foo!"
end
- def bar
+ def bar &dummy
@foo
end
end
- def bar
+ def bar &dummy
FooProc.new &lambda{
p 1
}
@@ -457,7 +457,7 @@
}
assert_equal 'ok', %q{
- def x
+ def x &dummy
binding
end
b = x{|a| a }
@@ -465,7 +465,7 @@
}, '[Bug #5634]'
assert_equal 'ok', %q{
- def x
+ def x &dummy
binding
end
eval("x { 'ok' }").eval "yield"
@@ -472,7 +472,7 @@
}, '[Bug #5634]'
assert_equal 'ok', %q{
- def x
+ def x &dummy
binding
end
def m
Index: spec/ruby/core/enumerable/fixtures/classes.rb
===================================================================
--- spec/ruby/core/enumerable/fixtures/classes.rb (リビジョン 66834)
+++ spec/ruby/core/enumerable/fixtures/classes.rb (作業コピー)
@@ -1,3 +1,5 @@
+
+
module EnumerableSpecs
class Numerous
@@ -37,13 +39,13 @@
class Empty
include Enumerable
- def each
+ def each &dummy
end
end
class EmptyWithSize
include Enumerable
- def each
+ def each &dummy
end
def size
0
@@ -52,7 +54,7 @@
class ThrowingEach
include Enumerable
- def each
+ def each &dummy
raise "from each"
end
end
Index: spec/ruby/core/kernel/fixtures/classes.rb
===================================================================
--- spec/ruby/core/kernel/fixtures/classes.rb (リビジョン 66834)
+++ spec/ruby/core/kernel/fixtures/classes.rb (作業コピー)
@@ -211,7 +211,7 @@
module BlockGiven
- def self.accept_block
+ def self.accept_block &dummy
block_given?
end
@@ -227,7 +227,7 @@
end
module SelfBlockGiven
- def self.accept_block
+ def self.accept_block &dummy
self.send(:block_given?)
end
@@ -243,7 +243,7 @@
end
module KernelBlockGiven
- def self.accept_block
+ def self.accept_block &dummy
Kernel.block_given?
end
Index: spec/ruby/core/kernel/proc_spec.rb
===================================================================
--- spec/ruby/core/kernel/proc_spec.rb (リビジョン 66834)
+++ spec/ruby/core/kernel/proc_spec.rb (作業コピー)
@@ -50,7 +50,7 @@
ruby_version_is "2.7" do
it "can be created when called with no block" do
- def some_method
+ def some_method &dummy
proc
end
Index: spec/ruby/core/proc/fixtures/common.rb
===================================================================
--- spec/ruby/core/proc/fixtures/common.rb (リビジョン 66834)
+++ spec/ruby/core/proc/fixtures/common.rb (作業コピー)
@@ -4,7 +4,7 @@
nil
end
end
- def self.new_proc_in_method
+ def self.new_proc_in_method &dummy
Proc.new
end
@@ -19,7 +19,7 @@
class ProcSubclass < Proc
end
- def self.new_proc_subclass_in_method
+ def self.new_proc_subclass_in_method &dummy
ProcSubclass.new
end
@@ -27,7 +27,7 @@
end
class MyProc2 < Proc
- def initialize(a, b)
+ def initialize(a, b, &dummy)
@first = a
@second = b
end
Index: spec/ruby/core/proc/new_spec.rb
===================================================================
--- spec/ruby/core/proc/new_spec.rb (リビジョン 66834)
+++ spec/ruby/core/proc/new_spec.rb (作業コピー)
@@ -52,7 +52,7 @@
before :each do
@subclass = Class.new(Proc) do
attr_reader :ok
- def initialize
+ def initialize &dummy
@ok = true
end
end
@@ -203,7 +203,7 @@
it "can be create when called with no block" do
- def some_method
+ def some_method &dummy
Proc.new
end
Index: spec/ruby/language/lambda_spec.rb
===================================================================
--- spec/ruby/language/lambda_spec.rb (リビジョン 66834)
+++ spec/ruby/language/lambda_spec.rb (作業コピー)
@@ -307,7 +307,7 @@
context "with an implicit block" do
before do
- def meth; lambda; end
+ def meth &dummy; lambda; end
end
ruby_version_is ""..."2.7" do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.