Revision: 1255 http://trac.macosforge.org/projects/ruby/changeset/1255 Author: eloy.de.enige@gmail.com Date: 2009-03-29 03:46:34 -0700 (Sun, 29 Mar 2009) Log Message: ----------- Commented a few examples in the for spec as they do not compile yet, tagged the remaining failing examples as fails, and added the for spec to the partially good files. Modified Paths: -------------- MacRuby/branches/experimental/rakelib/spec.rake MacRuby/branches/experimental/spec/frozen/language/for_spec.rb MacRuby/branches/experimental/spec/frozen/tags/macruby/language/for_tags.txt Modified: MacRuby/branches/experimental/rakelib/spec.rake =================================================================== --- MacRuby/branches/experimental/rakelib/spec.rake 2009-03-29 10:11:47 UTC (rev 1254) +++ MacRuby/branches/experimental/rakelib/spec.rake 2009-03-29 10:46:34 UTC (rev 1255) @@ -37,6 +37,7 @@ eigenclass encoding ensure + for loop magic_comment metaclass Modified: MacRuby/branches/experimental/spec/frozen/language/for_spec.rb =================================================================== --- MacRuby/branches/experimental/spec/frozen/language/for_spec.rb 2009-03-29 10:11:47 UTC (rev 1254) +++ MacRuby/branches/experimental/spec/frozen/language/for_spec.rb 2009-03-29 10:46:34 UTC (rev 1255) @@ -12,18 +12,20 @@ j.should == 6 end - it "iterates over an Hash passing each key-value pair to the block" do - k = 0 - l = 0 - - for i, j in { 1 => 10, 2 => 20 } - k += i - l += j - end - - k.should == 3 - l.should == 30 - end + # MacRuby TODO: This does not compile yet. + # + # it "iterates over an Hash passing each key-value pair to the block" do + # k = 0 + # l = 0 + # + # for i, j in { 1 => 10, 2 => 20 } + # k += i + # l += j + # end + # + # k.should == 3 + # l.should == 30 + # end it "iterates over any object responding to 'each'" do class XYZ @@ -39,15 +41,17 @@ j.should == 55 end - it "allows an instance variable as an iterator name" do - m = [1,2,3] - n = 0 - for @var in m - n += 1 - end - @var.should == 3 - n.should == 3 - end + # MacRuby TODO: This does not compile yet. + # + # it "allows an instance variable as an iterator name" do + # m = [1,2,3] + # n = 0 + # for @var in m + # n += 1 + # end + # @var.should == 3 + # n.should == 3 + # end # TODO: commented out due to a compiler error #it "allows a class variable as an iterator name" do @@ -108,10 +112,12 @@ a.should == 123 end - it "returns expr" do - for i in 1..3; end.should == (1..3) - for i,j in { 1 => 10, 2 => 20 }; end.should == { 1 => 10, 2 => 20 } - end + # MacRuby TODO: This does not compile yet. + # + # it "returns expr" do + # for i in 1..3; end.should == (1..3) + # for i,j in { 1 => 10, 2 => 20 }; end.should == { 1 => 10, 2 => 20 } + # end it "breaks out of a loop upon 'break', returning nil" do j = 0 @@ -140,17 +146,19 @@ j.should == 13 end - - it "repeats current iteration with 'redo'" do - j = 0 - for i in 1..3 - j += i - - redo if i == 2 && j < 4 - end - - j.should == 8 - end + + # MacRuby TODO: This does not compile yet. + # + # it "repeats current iteration with 'redo'" do + # j = 0 + # for i in 1..3 + # j += i + # + # redo if i == 2 && j < 4 + # end + # + # j.should == 8 + # end end language_version __FILE__, "for" \ No newline at end of file Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/language/for_tags.txt =================================================================== --- MacRuby/branches/experimental/spec/frozen/tags/macruby/language/for_tags.txt 2009-03-29 10:11:47 UTC (rev 1254) +++ MacRuby/branches/experimental/spec/frozen/tags/macruby/language/for_tags.txt 2009-03-29 10:46:34 UTC (rev 1255) @@ -1,4 +1,8 @@ -critical:The for expression iterates over an Hash passing each key-value pair to the block -critical:The for expression allows an instance variable as an iterator name -critical:The for expression returns expr -critical:The for expression repeats current iteration with 'redo' \ No newline at end of file +fails:The for expression iterates over an Enumerable passing each element to the block +fails:The for expression iterates over any object responding to 'each' +fails:The for expression splats multiple arguments together if there are fewer arguments than values +fails:The for expression optionally takes a 'do' after the expression +fails:The for expression allows body begin on the same line if do is used +fails:The for expression breaks out of a loop upon 'break', returning nil +fails:The for expression allows 'break' to have an argument which becomes the value of the for expression +fails:The for expression starts the next iteration with 'next' \ No newline at end of file