[macruby-changes] [3221] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 8 16:54:03 PST 2010


Revision: 3221
          http://trac.macosforge.org/projects/ruby/changeset/3221
Author:   ernest.prabhakar at gmail.com
Date:     2010-01-08 16:54:02 -0800 (Fri, 08 Jan 2010)
Log Message:
-----------
Fixed specs; Dispatch::Source now passes minimal specs

Modified Paths:
--------------
    MacRuby/trunk/gcd.c
    MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb
    MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt

Modified: MacRuby/trunk/gcd.c
===================================================================
--- MacRuby/trunk/gcd.c	2010-01-09 00:15:21 UTC (rev 3220)
+++ MacRuby/trunk/gcd.c	2010-01-09 00:54:02 UTC (rev 3221)
@@ -798,8 +798,11 @@
     Check_Queue(queue);
     rb_source_t *src = RSource(self);    
     src->type = rb_num2source_type(type);
-    src->source = dispatch_source_create(src->type,
-        NUM2UINT(handle), NUM2LONG(mask), RQueue(queue)->queue);
+    assert(src->type != NULL);
+    uintptr_t c_handle = NUM2UINT(handle);
+    unsigned long c_mask = NUM2LONG(mask);
+    dispatch_queue_t c_queue = RQueue(queue)->queue;
+    src->source = dispatch_source_create(src->type, c_handle, c_mask, c_queue);
     assert(src->source != NULL);
 
     if (rb_block_given_p()) {

Modified: MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	2010-01-09 00:15:21 UTC (rev 3220)
+++ MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	2010-01-09 00:54:02 UTC (rev 3221)
@@ -42,12 +42,22 @@
         end
 
         it "returns an instance of Dispatch::Source" do
-          p @type
-          src = Dispatch::Source.new(@type, 1, 2, @q) { true.should == true }
-          p src
+          src = Dispatch::Source.new(@type, 0, 0, @q) { true.should == true }
           src.should be_kind_of(Dispatch::Source)
         end
       end
+
+      describe :DATA_OR do
+        before :each do
+          @type = Dispatch::Source::DATA_OR
+        end
+
+        it "returns an instance of Dispatch::Source" do
+          src = Dispatch::Source.new(@type, 0, 0, @q) { true.should == true }
+          src.should be_kind_of(Dispatch::Source)
+        end
+      end
+
     end
     
   end

Modified: MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt
===================================================================
--- MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt	2010-01-09 00:15:21 UTC (rev 3220)
+++ MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt	2010-01-09 00:54:02 UTC (rev 3221)
@@ -1,2 +1 @@
-fails:Dispatch::Source of type DATA_ADD returns an instance of Dispatch::Source
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100108/f3add46a/attachment-0001.html>


More information about the macruby-changes mailing list