Revision
3142
Author
ernest.prabhakar@gmail.com
Date
2009-12-21 16:20:04 -0800 (Mon, 21 Dec 2009)

Log Message

Checkin skeleton of Dispatch::Source specs

Modified Paths

Added Paths

Diff

Added: MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb (0 => 3142)


--- MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	2009-12-22 00:20:04 UTC (rev 3142)
@@ -0,0 +1,88 @@
+require File.dirname(__FILE__) + "/../../spec_helper"
+
+if MACOSX_VERSION >= 10.6
+
+  describe "Dispatch::Source" do
+
+    describe "constants" do
+      it "for custom sources" do
+        Dispatch::Source.const_defined?(:DATA_ADD).should == true
+        Dispatch::Source.const_defined?(:DATA_OR).should == true
+      end
+
+      it "for process sources" do
+        Dispatch::Source.const_defined?(:PROC).should == true
+        Dispatch::Source.const_defined?(:SIGNAL).should == true
+      end
+
+      it "for file sources" do
+        Dispatch::Source.const_defined?(:READ).should == true
+        Dispatch::Source.const_defined?(:VNODE).should == true
+        Dispatch::Source.const_defined?(:WRITE).should == true
+      end
+
+      it "for timer source" do
+        Dispatch::Source.const_defined?(:TIME).should == true
+      end
+
+      it "NOT for mach sources" do
+        Dispatch::Source.const_defined?(:MACH_SEND).should == false
+        Dispatch::Source.const_defined?(:MACH_RECV).should == false
+      end
+    end
+    
+    describe "event handler" do
+      before :each do
+        @q = Dispatch::Queue.concurrent
+        @src = Dispatch::Source.new() #@type, @handle, mask, @q
+      end
+
+      it "can be set" do
+        true.should == false
+      end
+
+      it "will be invoked" do
+        true.should == false
+      end
+
+      it "receives the source" do
+        true.should == false
+      end
+
+      it "can get data" do
+        true.should == false
+      end
+
+      it "will get merged data" do
+        true.should == false
+      end
+
+      it "can get handle" do
+        true.should == false
+      end
+
+      it "can get mask" do
+        true.should == false
+      end
+
+    end
+
+    describe "cancel handler" do
+      before :each do
+        @q = Dispatch::Queue.concurrent
+        @src = Dispatch::Source.new() #@type, @handle, mask, @q
+      end
+
+      it "can be set" do
+        true.should == false
+      end
+
+      it "will be invoked" do
+        true.should == false
+      end
+    end
+
+
+  end
+
+end

Modified: MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt (3141 => 3142)


--- MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt	2009-12-21 20:37:44 UTC (rev 3141)
+++ MacRuby/trunk/spec/macruby/tags/macruby/core/gcd/source_tags.txt	2009-12-22 00:20:04 UTC (rev 3142)
@@ -0,0 +1,13 @@
+fails:Dispatch::Source constants for custom sources
+fails:Dispatch::Source constants for process sources
+fails:Dispatch::Source constants for file sources
+fails:Dispatch::Source constants for timer source
+fails:Dispatch::Source event handler can be set
+fails:Dispatch::Source event handler will be invoked
+fails:Dispatch::Source event handler receives the source
+fails:Dispatch::Source event handler can get data
+fails:Dispatch::Source event handler will get merged data
+fails:Dispatch::Source event handler can get handle
+fails:Dispatch::Source event handler can get mask
+fails:Dispatch::Source cancel handler can be set
+fails:Dispatch::Source cancel handler will be invoked