[macruby-changes] [2592] MacRuby/trunk/spec/macruby/core
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 21 01:25:25 PDT 2009
Revision: 2592
http://trac.macosforge.org/projects/ruby/changeset/2592
Author: eloy.de.enige at gmail.com
Date: 2009-09-21 01:25:21 -0700 (Mon, 21 Sep 2009)
Log Message:
-----------
Ticket #309: Added failing specs for adding accessors to the singleton class of String, Hash and Array instances.
Modified Paths:
--------------
MacRuby/trunk/spec/macruby/core/array_spec.rb
MacRuby/trunk/spec/macruby/core/hash_spec.rb
MacRuby/trunk/spec/macruby/core/string_spec.rb
Modified: MacRuby/trunk/spec/macruby/core/array_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/array_spec.rb 2009-09-21 00:49:55 UTC (rev 2591)
+++ MacRuby/trunk/spec/macruby/core/array_spec.rb 2009-09-21 08:25:21 UTC (rev 2592)
@@ -45,6 +45,15 @@
a << 42
a[0].should == 42
end
+
+ it "can have a singleton class with an attr_accessor" do
+ a = []
+ class << a
+ attr_accessor :foo
+ end
+ a.foo = 42
+ a.foo.should == 42
+ end
end
describe "An NSArray object" do
Modified: MacRuby/trunk/spec/macruby/core/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/hash_spec.rb 2009-09-21 00:49:55 UTC (rev 2591)
+++ MacRuby/trunk/spec/macruby/core/hash_spec.rb 2009-09-21 08:25:21 UTC (rev 2592)
@@ -45,6 +45,15 @@
a[42] = 123
a[42].should == 123
end
+
+ it "can have a singleton class with an attr_accessor" do
+ a = {}
+ class << a
+ attr_accessor :foo
+ end
+ a.foo = 42
+ a.foo.should == 42
+ end
end
describe "An NSDictionary object" do
Modified: MacRuby/trunk/spec/macruby/core/string_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/string_spec.rb 2009-09-21 00:49:55 UTC (rev 2591)
+++ MacRuby/trunk/spec/macruby/core/string_spec.rb 2009-09-21 08:25:21 UTC (rev 2592)
@@ -45,6 +45,15 @@
a << 'foo'
a.should == 'foo'
end
+
+ it "can have a singleton class with an attr_accessor" do
+ a = ''
+ class << a
+ attr_accessor :foo
+ end
+ a.foo = 42
+ a.foo.should == 42
+ end
end
describe "An NSString object" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090921/4cc3cc98/attachment.html>
More information about the macruby-changes
mailing list