ruby-changes:64303
From: Yusuke <ko1@a...>
Date: Sat, 19 Dec 2020 03:17:12 +0900 (JST)
Subject: [ruby-changes:64303] 346bf0f5a5 (master): spec/ruby/core/module/attr_*: Add version guards
https://git.ruby-lang.org/ruby.git/commit/?id=346bf0f5a5 From 346bf0f5a586ce6140e28aca145e5b6a8160ee4f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sat, 19 Dec 2020 03:16:20 +0900 Subject: spec/ruby/core/module/attr_*: Add version guards diff --git a/spec/ruby/core/module/attr_accessor_spec.rb b/spec/ruby/core/module/attr_accessor_spec.rb index c4133d8..665a934 100644 --- a/spec/ruby/core/module/attr_accessor_spec.rb +++ b/spec/ruby/core/module/attr_accessor_spec.rb @@ -67,9 +67,19 @@ describe "Module#attr_accessor" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_accessor_spec.rb#L67 Module.should have_public_instance_method(:attr_accessor, false) end - it "returns an array of defined methods names as symbols" do - Class.new do - (attr_accessor :foo, 'bar').should == [:foo, :foo=, :bar, :bar=] + ruby_version_is ""..."3.0" do + it "returns nil" do + Class.new do + (attr_accessor :foo, 'bar').should == nil + end + end + end + + ruby_version_is "3.0" do + it "returns an array of defined methods names as symbols" do + Class.new do + (attr_accessor :foo, 'bar').should == [:foo, :foo=, :bar, :bar=] + end end end diff --git a/spec/ruby/core/module/attr_reader_spec.rb b/spec/ruby/core/module/attr_reader_spec.rb index 0693909..e16b7ba 100644 --- a/spec/ruby/core/module/attr_reader_spec.rb +++ b/spec/ruby/core/module/attr_reader_spec.rb @@ -62,9 +62,19 @@ describe "Module#attr_reader" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_reader_spec.rb#L62 Module.should have_public_instance_method(:attr_reader, false) end - it "returns an array of defined methods names as symbols" do - Class.new do - (attr_reader :foo, 'bar').should == [:foo, :bar] + ruby_version_is ""..."3.0" do + it "returns nil" do + Class.new do + (attr_reader :foo, 'bar').should == nil + end + end + end + + ruby_version_is "3.0" do + it "returns an array of defined methods names as symbols" do + Class.new do + (attr_reader :foo, 'bar').should == [:foo, :bar] + end end end end diff --git a/spec/ruby/core/module/attr_spec.rb b/spec/ruby/core/module/attr_spec.rb index 8c7d27e..060d072 100644 --- a/spec/ruby/core/module/attr_spec.rb +++ b/spec/ruby/core/module/attr_spec.rb @@ -146,11 +146,23 @@ describe "Module#attr" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_spec.rb#L146 Module.should have_public_instance_method(:attr, false) end - it "returns an array of defined methods names as symbols" do - Class.new do - (attr :foo, 'bar').should == [:foo, :bar] - (attr :baz, false).should == [:baz] - (attr :qux, true).should == [:qux, :qux=] + ruby_version_is ""..."3.0" do + it "returns nil" do + Class.new do + (attr :foo, 'bar').should == nil + (attr :baz, false).should == nil + (attr :qux, true).should == nil + end + end + end + + ruby_version_is "3.0" do + it "returns an array of defined methods names as symbols" do + Class.new do + (attr :foo, 'bar').should == [:foo, :bar] + (attr :baz, false).should == [:baz] + (attr :qux, true).should == [:qux, :qux=] + end end end end diff --git a/spec/ruby/core/module/attr_writer_spec.rb b/spec/ruby/core/module/attr_writer_spec.rb index c5a00b8..59d8b7b 100644 --- a/spec/ruby/core/module/attr_writer_spec.rb +++ b/spec/ruby/core/module/attr_writer_spec.rb @@ -62,9 +62,19 @@ describe "Module#attr_writer" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_writer_spec.rb#L62 Module.should have_public_instance_method(:attr_writer, false) end - it "returns an array of defined methods names as symbols" do - Class.new do - (attr_writer :foo, 'bar').should == [:foo=, :bar=] + ruby_version_is ""..."3.0" do + it "returns nil" do + Class.new do + (attr_writer :foo, 'bar').should == nil + end + end + end + + ruby_version_is "3.0" do + it "returns an array of defined methods names as symbols" do + Class.new do + (attr_writer :foo, 'bar').should == [:foo=, :bar=] + end end end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/