[macruby-changes] [1679] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Sun May 31 05:12:32 PDT 2009
Revision: 1679
http://trac.macosforge.org/projects/ruby/changeset/1679
Author: eloy.de.enige at gmail.com
Date: 2009-05-31 05:12:32 -0700 (Sun, 31 May 2009)
Log Message:
-----------
Enabled Kernel#send spec as Laurent fixed the crtical bug.
Modified Paths:
--------------
MacRuby/branches/experimental/rakelib/spec.rake
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec.rb
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec_disabled.rb
Modified: MacRuby/branches/experimental/rakelib/spec.rake
===================================================================
--- MacRuby/branches/experimental/rakelib/spec.rake 2009-05-31 12:11:39 UTC (rev 1678)
+++ MacRuby/branches/experimental/rakelib/spec.rake 2009-05-31 12:12:32 UTC (rev 1679)
@@ -71,7 +71,6 @@
spec/frozen/core/nil
spec/frozen/core/numeric
spec/frozen/core/object
- spec/frozen/core/send
spec/frozen/core/symbol
spec/frozen/core/true
spec/frozen/core/unboundmethod
Copied: MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec.rb (from rev 1678, MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec_disabled.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec.rb 2009-05-31 12:12:32 UTC (rev 1679)
@@ -0,0 +1,102 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
+
+describe "Kernel#send" do
+ it "invokes the named method" do
+ class KernelSpecs::Foo
+ def bar
+ 'done'
+ end
+
+ private
+ def bar2
+ 'done2'
+ end
+ end
+ KernelSpecs::Foo.new.send(:bar).should == 'done'
+ KernelSpecs::Foo.new.send(:bar2).should == 'done2'
+ end
+
+ it "invokes a class method if called on a class" do
+ class KernelSpecs::Foo
+ def self.bar
+ 'done'
+ end
+ end
+ KernelSpecs::Foo.send(:bar).should == 'done'
+ end
+
+ it "raises a NoMethodError if the corresponding method can't be found" do
+ class KernelSpecs::Foo
+ def bar
+ 'done'
+ end
+ end
+ lambda { KernelSpecs::Foo.new.send(:baz) }.should raise_error(NameError)
+ end
+
+ it "raises a NoMethodError if the corresponding singleton method can't be found" do
+ class KernelSpecs::Foo
+ def self.bar
+ 'done'
+ end
+ end
+ lambda { KernelSpecs::Foo.send(:baz) }.should raise_error(NameError)
+ end
+
+ it "raises an ArgumentError if called with more arguments than available parameters" do
+ class KernelSpecs::Foo
+ def bar; end
+ end
+
+ lambda { KernelSpecs::Foo.new.send(:bar, :arg) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if called with fewer arguments than required parameters" do
+ class KernelSpecs::Foo
+ def foo(arg); end
+ end
+
+ lambda { KernelSpecs::Foo.new.send(:foo) }.should raise_error(ArgumentError)
+ end
+
+ it "succeeds if passed an arbitrary number of arguments as a splat parameter" do
+ class KernelSpecs::Foo
+ def baz(*args) args end
+ end
+
+ begin
+ KernelSpecs::Foo.new.send(:baz).should == []
+ KernelSpecs::Foo.new.send(:baz, :quux).should == [:quux]
+ KernelSpecs::Foo.new.send(:baz, :quux, :foo).should == [:quux, :foo]
+ rescue
+ fail
+ end
+ end
+
+ it "succeeds when passing 1 or more arguments as a required and a splat parameter" do
+ class KernelSpecs::Foo
+ def foo(first, *rest) [first, *rest] end
+ end
+
+ begin
+ KernelSpecs::Foo.new.send(:baz, :quux).should == [:quux]
+ KernelSpecs::Foo.new.send(:baz, :quux, :foo).should == [:quux, :foo]
+ rescue
+ fail
+ end
+ end
+
+ it "succeeds when passing 0 arguments to a method with one parameter with a default" do
+ class KernelSpecs::Foo
+ def foo(first = true) first end
+ end
+
+ begin
+ KernelSpecs::Foo.new.send(:foo).should == true
+ KernelSpecs::Foo.new.send(:foo, :arg).should == :arg
+ rescue
+ fail
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec_disabled.rb 2009-05-31 12:11:39 UTC (rev 1678)
+++ MacRuby/branches/experimental/spec/frozen/core/kernel/send_spec_disabled.rb 2009-05-31 12:12:32 UTC (rev 1679)
@@ -1,102 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes'
-
-describe "Kernel#send" do
- it "invokes the named method" do
- class KernelSpecs::Foo
- def bar
- 'done'
- end
-
- private
- def bar2
- 'done2'
- end
- end
- KernelSpecs::Foo.new.send(:bar).should == 'done'
- KernelSpecs::Foo.new.send(:bar2).should == 'done2'
- end
-
- it "invokes a class method if called on a class" do
- class KernelSpecs::Foo
- def self.bar
- 'done'
- end
- end
- KernelSpecs::Foo.send(:bar).should == 'done'
- end
-
- it "raises a NoMethodError if the corresponding method can't be found" do
- class KernelSpecs::Foo
- def bar
- 'done'
- end
- end
- lambda { KernelSpecs::Foo.new.send(:baz) }.should raise_error(NameError)
- end
-
- it "raises a NoMethodError if the corresponding singleton method can't be found" do
- class KernelSpecs::Foo
- def self.bar
- 'done'
- end
- end
- lambda { KernelSpecs::Foo.send(:baz) }.should raise_error(NameError)
- end
-
- it "raises an ArgumentError if called with more arguments than available parameters" do
- class KernelSpecs::Foo
- def bar; end
- end
-
- lambda { KernelSpecs::Foo.new.send(:bar, :arg) }.should raise_error(ArgumentError)
- end
-
- it "raises an ArgumentError if called with fewer arguments than required parameters" do
- class KernelSpecs::Foo
- def foo(arg); end
- end
-
- lambda { KernelSpecs::Foo.new.send(:foo) }.should raise_error(ArgumentError)
- end
-
- it "succeeds if passed an arbitrary number of arguments as a splat parameter" do
- class KernelSpecs::Foo
- def baz(*args) args end
- end
-
- begin
- KernelSpecs::Foo.new.send(:baz).should == []
- KernelSpecs::Foo.new.send(:baz, :quux).should == [:quux]
- KernelSpecs::Foo.new.send(:baz, :quux, :foo).should == [:quux, :foo]
- rescue
- fail
- end
- end
-
- it "succeeds when passing 1 or more arguments as a required and a splat parameter" do
- class KernelSpecs::Foo
- def foo(first, *rest) [first, *rest] end
- end
-
- begin
- KernelSpecs::Foo.new.send(:baz, :quux).should == [:quux]
- KernelSpecs::Foo.new.send(:baz, :quux, :foo).should == [:quux, :foo]
- rescue
- fail
- end
- end
-
- it "succeeds when passing 0 arguments to a method with one parameter with a default" do
- class KernelSpecs::Foo
- def foo(first = true) first end
- end
-
- begin
- KernelSpecs::Foo.new.send(:foo).should == true
- KernelSpecs::Foo.new.send(:foo, :arg).should == :arg
- rescue
- fail
- end
- end
-end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090531/f0e7e7f0/attachment-0001.html>
More information about the macruby-changes
mailing list