[macruby-changes] [3473] MacRuby/trunk/spec/macruby/core

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 9 18:35:40 PST 2010


Revision: 3473
          http://trac.macosforge.org/projects/ruby/changeset/3473
Author:   lsansonetti at apple.com
Date:     2010-02-09 18:35:37 -0800 (Tue, 09 Feb 2010)
Log Message:
-----------
more macruby spec refresh

Modified Paths:
--------------
    MacRuby/trunk/spec/macruby/core/pointer_spec.rb
    MacRuby/trunk/spec/macruby/core/struct_spec.rb

Modified: MacRuby/trunk/spec/macruby/core/pointer_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/pointer_spec.rb	2010-02-10 01:06:55 UTC (rev 3472)
+++ MacRuby/trunk/spec/macruby/core/pointer_spec.rb	2010-02-10 02:35:37 UTC (rev 3473)
@@ -125,7 +125,7 @@
     ptr = Pointer.new('^{__CFError}')
     ptr[0].should == nil
     CFURLResourceIsReachable(NSURL.URLWithString('http://doesnotexistomgwtf.be'), ptr).should == false
-    ptr[0].class.should == NSCFError
+    ptr[0].is_a?(NSError).should == true
   end
 
   it "handle 'void *' C pointers as 'unsigned char *'" do

Modified: MacRuby/trunk/spec/macruby/core/struct_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/struct_spec.rb	2010-02-10 01:06:55 UTC (rev 3472)
+++ MacRuby/trunk/spec/macruby/core/struct_spec.rb	2010-02-10 02:35:37 UTC (rev 3473)
@@ -143,22 +143,32 @@
     NSPoint.new.should_not == NSSize.new
   end
 
+  if MACOSX_VERSION <= 10.6
+    NSPOINT_CNAME = 'CGPoint'
+    NSSIZE_CNAME = 'CGSize'
+    NSRECT_CNAME = 'CGRect'
+  else
+    NSPOINT_CNAME = 'NSPoint'
+    NSSIZE_CNAME = 'NSSize'
+    NSRECT_CNAME = 'NSRect'
+  end
+
   it "has a nice #inspect message that lists the fields" do
     p = NSPoint.new
-    p.inspect.should == "#<CGPoint x=0.0 y=0.0>"
+    p.inspect.should == "#<#{NSPOINT_CNAME} x=0.0 y=0.0>"
     p.x = 1
     p.y = 2
-    p.inspect.should == "#<CGPoint x=1.0 y=2.0>"
+    p.inspect.should == "#<#{NSPOINT_CNAME} x=1.0 y=2.0>"
 
     s = NSSize.new(3, 4)
-    s.inspect.should == "#<CGSize width=3.0 height=4.0>"
+    s.inspect.should == "#<#{NSSIZE_CNAME} width=3.0 height=4.0>"
 
     r = NSRect.new
-    r.inspect.should == "#<CGRect origin=#<CGPoint x=0.0 y=0.0> size=#<CGSize width=0.0 height=0.0>>"
+    r.inspect.should == "#<#{NSRECT_CNAME} origin=#<#{NSPOINT_CNAME} x=0.0 y=0.0> size=#<#{NSSIZE_CNAME} width=0.0 height=0.0>>"
     r.origin = p
-    r.inspect.should == "#<CGRect origin=#<CGPoint x=1.0 y=2.0> size=#<CGSize width=0.0 height=0.0>>"
+    r.inspect.should == "#<#{NSRECT_CNAME} origin=#<#{NSPOINT_CNAME} x=1.0 y=2.0> size=#<#{NSSIZE_CNAME} width=0.0 height=0.0>>"
     r.size = s
-    r.inspect.should == "#<CGRect origin=#<CGPoint x=1.0 y=2.0> size=#<CGSize width=3.0 height=4.0>>"
+    r.inspect.should == "#<#{NSRECT_CNAME} origin=#<#{NSPOINT_CNAME} x=1.0 y=2.0> size=#<#{NSSIZE_CNAME} width=3.0 height=4.0>>"
   end
 
   it "can be duplicated using #dup or #clone" do
@@ -204,13 +214,15 @@
     end
   end
 
-  it "defined after a structure which has the same type is an alias to the other structure class" do
-    NSPoint.should == CGPoint
-    NSSize.should == CGSize
-    NSRect.should == CGRect
-    NSPoint.object_id.should == CGPoint.object_id
-    NSSize.object_id.should == CGSize.object_id
-    NSRect.object_id.should == CGRect.object_id
+  if MACOSX_VERSION <= 10.6
+    it "defined after a structure which has the same type is an alias to the other structure class" do
+      NSPoint.should == CGPoint
+      NSSize.should == CGSize
+      NSRect.should == CGRect
+      NSPoint.object_id.should == CGPoint.object_id
+      NSSize.object_id.should == CGSize.object_id
+      NSRect.object_id.should == CGRect.object_id
+    end
   end
 
   it "returns an Array based on its elements when #to_a is called" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100209/99080f1f/attachment-0001.html>


More information about the macruby-changes mailing list