From 646632e3cb7cb4ef9ba2ad6d66d15da92929cbdc Mon Sep 17 00:00:00 2001 From: Sergio Hilgert Date: Fri, 15 Oct 2021 13:04:02 -0300 Subject: [PATCH 1/2] add specs to feature 9573 --- language/module_spec.rb | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/language/module_spec.rb b/language/module_spec.rb index 1a5fcaf46f..969bd9359f 100644 --- a/language/module_spec.rb +++ b/language/module_spec.rb @@ -99,3 +99,57 @@ module ModuleSpecs::Modules::Klass; end d.name.should == "ModuleSpecs_CS2::D" end end + +ruby_version_is "3.0" do + describe "Include" do + context "when the include in the module is done after the include in the class" do + it "includes the M1 and M2 module" do + class A; end + module B1; end + module C2; end + + A.include B1 + B1.include C2 + A.ancestors.should == [A, B1, C2, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] + end + end + + context "when the include in the module is done before the include in the class" do + it "includes the M1 and M2 module" do + class D; end + module E1; end + module F2; end + + E1.include F2 + D.include E1 + D.ancestors.should == [D, E1, F2, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] + end + end + end + + describe "Prepend" do + context "when the include in the module is done after the include in the class" do + it "includes the M1 and M2 module" do + class G; end + module H1; end + module I2; end + + G.prepend H1 + H1.prepend I2 + G.ancestors.should == [I2, H1, G, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] + end + end + + context "when the include in the module is done before the include in the class" do + it "includes the M1 and M2 module" do + class J; end + module K1; end + module L2; end + + K1.prepend L2 + J.prepend K1 + J.ancestors.should == [L2, K1, J, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] + end + end + end +end From 8828653f98c01a47c451afb379d2f7a9e33f83d2 Mon Sep 17 00:00:00 2001 From: Sergio Hilgert Date: Fri, 15 Oct 2021 13:08:26 -0300 Subject: [PATCH 2/2] update specs grammar --- language/module_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/language/module_spec.rb b/language/module_spec.rb index 969bd9359f..5c16ab31cc 100644 --- a/language/module_spec.rb +++ b/language/module_spec.rb @@ -128,8 +128,8 @@ module F2; end end describe "Prepend" do - context "when the include in the module is done after the include in the class" do - it "includes the M1 and M2 module" do + context "when the prepend in the module is done after the prepend in the class" do + it "prepends the M1 and M2 module" do class G; end module H1; end module I2; end @@ -140,8 +140,8 @@ module I2; end end end - context "when the include in the module is done before the include in the class" do - it "includes the M1 and M2 module" do + context "when the prepend in the module is done before the prepend in the class" do + it "prepends the M1 and M2 module" do class J; end module K1; end module L2; end