Revision
3221
Author
ernest.prabhakar@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

Diff

Modified: MacRuby/trunk/gcd.c (3220 => 3221)


--- 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 (3220 => 3221)


--- 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 (3220 => 3221)


--- 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