[macruby-changes] [3237] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 11 11:23:49 PST 2010


Revision: 3237
          http://trac.macosforge.org/projects/ruby/changeset/3237
Author:   ernest.prabhakar at gmail.com
Date:     2010-01-11 11:23:45 -0800 (Mon, 11 Jan 2010)
Log Message:
-----------
Added flags for Dispatch::Source

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

Modified: MacRuby/trunk/gcd.c
===================================================================
--- MacRuby/trunk/gcd.c	2010-01-11 05:57:28 UTC (rev 3236)
+++ MacRuby/trunk/gcd.c	2010-01-11 19:23:45 UTC (rev 3237)
@@ -1241,6 +1241,20 @@
     rb_define_const(cSource, "SIGNAL", INT2NUM(SOURCE_TYPE_SIGNAL));
     rb_define_const(cSource, "VNODE", INT2NUM(SOURCE_TYPE_VNODE));
     rb_define_const(cSource, "WRITE", INT2NUM(SOURCE_TYPE_WRITE));
+    
+    rb_define_const(cSource, "PROC_EXIT", INT2NUM(DISPATCH_PROC_EXIT));
+    rb_define_const(cSource, "PROC_FORK", INT2NUM(DISPATCH_PROC_FORK));
+    rb_define_const(cSource, "PROC_EXEC", INT2NUM(DISPATCH_PROC_EXEC));
+    rb_define_const(cSource, "PROC_SIGNAL", INT2NUM(DISPATCH_PROC_SIGNAL));
+
+    rb_define_const(cSource, "VNODE_DELETE", INT2NUM(DISPATCH_VNODE_DELETE));
+    rb_define_const(cSource, "VNODE_WRITE", INT2NUM(DISPATCH_VNODE_WRITE));
+    rb_define_const(cSource, "VNODE_EXTEND", INT2NUM(DISPATCH_VNODE_EXTEND));
+    rb_define_const(cSource, "VNODE_ATTRIB", INT2NUM(DISPATCH_VNODE_ATTRIB));
+    rb_define_const(cSource, "VNODE_LINK", INT2NUM(DISPATCH_VNODE_LINK));
+    rb_define_const(cSource, "VNODE_RENAME", INT2NUM(DISPATCH_VNODE_RENAME));
+    rb_define_const(cSource, "VNODE_REVOKE", INT2NUM(DISPATCH_VNODE_REVOKE));
+    
     rb_objc_define_method(*(VALUE *)cSource, "alloc", rb_source_alloc, 0);
     rb_objc_define_method(cSource, "initialize", rb_source_init, 4);
     rb_objc_define_method(cSource, "on_cancel", rb_source_on_cancellation, 0);

Modified: MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	2010-01-11 05:57:28 UTC (rev 3236)
+++ MacRuby/trunk/spec/macruby/core/gcd/source_spec.rb	2010-01-11 19:23:45 UTC (rev 3237)
@@ -5,30 +5,48 @@
   describe "Dispatch::Source" do
 
     describe "constants" do
-      it "for custom sources" do
+      it "for custom source types" do
         Dispatch::Source.const_defined?(:DATA_ADD).should == true
         Dispatch::Source.const_defined?(:DATA_OR).should == true
       end
 
-      it "for process sources" do
+      it "for process source types" do
         Dispatch::Source.const_defined?(:PROC).should == true
         Dispatch::Source.const_defined?(:SIGNAL).should == true
       end
 
-      it "for file sources" do
+      it "for file source types" do
         Dispatch::Source.const_defined?(:READ).should == true
         Dispatch::Source.const_defined?(:VNODE).should == true
         Dispatch::Source.const_defined?(:WRITE).should == true
       end
 
-      it "NOT for timer source" do
+      it "NOT for timer source type" do
         Dispatch::Source.const_defined?(:TIMER).should == false
       end
 
-      it "NOT for mach sources" do
+      it "NOT for mach source types" do
         Dispatch::Source.const_defined?(:MACH_SEND).should == false
         Dispatch::Source.const_defined?(:MACH_RECV).should == false
       end
+      
+      it "for process events" do
+        Dispatch::Source.const_defined?(:PROC_EXIT).should == true
+        Dispatch::Source.const_defined?(:PROC_FORK).should == true
+        Dispatch::Source.const_defined?(:PROC_EXEC).should == true
+        Dispatch::Source.const_defined?(:PROC_SIGNAL).should == true
+      end
+
+      it "for vnode events" do
+        Dispatch::Source.const_defined?(:VNODE_DELETE).should == true
+        Dispatch::Source.const_defined?(:VNODE_WRITE).should == true
+        Dispatch::Source.const_defined?(:VNODE_EXTEND).should == true
+        Dispatch::Source.const_defined?(:VNODE_ATTRIB).should == true
+        Dispatch::Source.const_defined?(:VNODE_LINK).should == true
+        Dispatch::Source.const_defined?(:VNODE_RENAME).should == true
+        Dispatch::Source.const_defined?(:VNODE_REVOKE).should == true
+      end
+      
     end
 
     describe "of type" do
@@ -152,6 +170,7 @@
         before :each do
           @type = Dispatch::Source::SIGNAL
           @signal = Signal.list["USR2"]
+          
         end
 
         it "returns an instance of Dispatch::Source" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100111/67859709/attachment.html>


More information about the macruby-changes mailing list