[macruby-changes] [1484] MacRuby/branches/experimental/spec/macruby

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 23 21:28:43 PDT 2009


Revision: 1484
          http://trac.macosforge.org/projects/ruby/changeset/1484
Author:   lsansonetti at apple.com
Date:     2009-04-23 21:28:43 -0700 (Thu, 23 Apr 2009)
Log Message:
-----------
added a spec to test a method receiving lots of C types (small and big)

Modified Paths:
--------------
    MacRuby/branches/experimental/spec/macruby/fixtures/method.m
    MacRuby/branches/experimental/spec/macruby/method_spec.rb

Modified: MacRuby/branches/experimental/spec/macruby/fixtures/method.m
===================================================================
--- MacRuby/branches/experimental/spec/macruby/fixtures/method.m	2009-04-24 03:45:14 UTC (rev 1483)
+++ MacRuby/branches/experimental/spec/macruby/fixtures/method.m	2009-04-24 04:28:43 UTC (rev 1484)
@@ -292,6 +292,16 @@
     return r.location == 0 && r.length == 42;
 }
 
+- (BOOL)methodAcceptingInt:(int)a1 float:(float)a2 double:(double)a3
+	short:(short)a4 NSPoint:(NSPoint)a5 NSRect:(NSRect)a6 char:(char)a7
+{
+    return a1 == 42 && a2 == 42.0 && a3 == 42.0 && a4 == 42
+	&& a5.x == 42.0 && a5.y == 42.0
+	&& a6.origin.x == 42.0 && a6.origin.y == 42.0
+	&& a6.size.width == 42.0 && a6.size.height == 42.0
+	&& a7 == 42;
+}
+
 @end
 
 void

Modified: MacRuby/branches/experimental/spec/macruby/method_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/macruby/method_spec.rb	2009-04-24 03:45:14 UTC (rev 1483)
+++ MacRuby/branches/experimental/spec/macruby/method_spec.rb	2009-04-24 04:28:43 UTC (rev 1484)
@@ -424,4 +424,9 @@
     lambda { @o.methodAcceptingNSRect([[1, 2], [3]]) }.should raise_error(ArgumentError)
     lambda { @o.methodAcceptingNSRect([[1, 2], [3, 4, 5]]) }.should raise_error(ArgumentError)
   end
+
+  it "accepting various C types should receive these types as expected" do
+    @o.methodAcceptingInt(42, float:42, double:42, short:42, NSPoint:[42, 42],
+                          NSRect:[42, 42, 42, 42], char:42).should == 1
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090423/ab865a1f/attachment.html>


More information about the macruby-changes mailing list