[macruby-changes] [3111] MacRuby/trunk/spec/macruby/core/gcd/block_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 14 11:30:10 PST 2009


Revision: 3111
          http://trac.macosforge.org/projects/ruby/changeset/3111
Author:   ernest.prabhakar at gmail.com
Date:     2009-12-14 11:30:09 -0800 (Mon, 14 Dec 2009)
Log Message:
-----------
Added block_spec to verify local copy vs. instance refs

Added Paths:
-----------
    MacRuby/trunk/spec/macruby/core/gcd/block_spec.rb

Added: MacRuby/trunk/spec/macruby/core/gcd/block_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/gcd/block_spec.rb	                        (rev 0)
+++ MacRuby/trunk/spec/macruby/core/gcd/block_spec.rb	2009-12-14 19:30:09 UTC (rev 3111)
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + "/../../spec_helper"
+
+if MACOSX_VERSION >= 10.6  
+
+  describe "Dispatch blocks" do
+    before :each do
+      @q = Dispatch::Queue.new('org.macruby.gcd_spec.blocks')
+    end
+
+    it "should create const copies of dynamic (local) variables" do
+      i = 42
+      @q.sync {i = 1}
+      i.should == 42
+    end
+
+    it "should have read-write references to instance (__block) variables" do
+      @i = 42
+      @q.sync {@i = 1}
+      @i.should == 1
+    end
+  end
+
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091214/44894218/attachment.html>


More information about the macruby-changes mailing list