[macruby-changes] [1110] MacRuby/branches/experimental/spec/frozen/language
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 23 08:25:14 PDT 2009
Revision: 1110
http://trac.macosforge.org/projects/ruby/changeset/1110
Author: eloy.de.enige at gmail.com
Date: 2009-03-23 08:25:14 -0700 (Mon, 23 Mar 2009)
Log Message:
-----------
Moved some 1.8 specific 'retry' examples into a language version specific file and added a 1.9 example.
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/language/retry_spec.rb
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.8.rb
MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.9.rb
Modified: MacRuby/branches/experimental/spec/frozen/language/retry_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/retry_spec.rb 2009-03-23 15:15:49 UTC (rev 1109)
+++ MacRuby/branches/experimental/spec/frozen/language/retry_spec.rb 2009-03-23 15:25:14 UTC (rev 1110)
@@ -1,12 +1,6 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe "The retry statement" do
- it "raises a LocalJumpError if used outside of a block" do
- def bad_meth_retry; retry; end
- lambda { bad_meth_retry() }.should raise_error(LocalJumpError)
- lambda { lambda { retry }.call }.should raise_error(LocalJumpError)
- end
-
it "re-executes the closest block" do
retry_first = true
retry_second = true
@@ -36,21 +30,6 @@
results.should == [1, 2, 3, 1, 2, 4, 5, 6, 4, 5]
end
-
- # block retry has been officially deprecated by matz and is unsupported in 1.9
- ruby_version_is "" ... "1.9" do
- not_compliant_on :rubinius do
- it "re-executes the entire enumeration" do
- list = []
- [1,2,3].each do |x|
- list << x
- break if list.size == 6
- retry if x == 3
- end
- list.should == [1,2,3,1,2,3]
- end
- end
- end
end
describe "The retry keyword inside a begin block's rescue block" do
@@ -67,3 +46,5 @@
counter.should == 7
end
end
+
+language_version __FILE__, "retry"
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.8.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.8.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.8.rb 2009-03-23 15:25:14 UTC (rev 1110)
@@ -0,0 +1,20 @@
+describe "The retry statement" do
+ it "raises a LocalJumpError if used outside of a block" do
+ def bad_meth_retry; retry; end
+ lambda { bad_meth_retry() }.should raise_error(LocalJumpError)
+ lambda { lambda { retry }.call }.should raise_error(LocalJumpError)
+ end
+
+ # block retry has been officially deprecated by matz and is unsupported in 1.9
+ not_compliant_on :rubinius do
+ it "re-executes the entire enumeration" do
+ list = []
+ [1,2,3].each do |x|
+ list << x
+ break if list.size == 6
+ retry if x == 3
+ end
+ list.should == [1,2,3,1,2,3]
+ end
+ end
+end
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.9.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.9.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/language/versions/retry_1.9.rb 2009-03-23 15:25:14 UTC (rev 1110)
@@ -0,0 +1,6 @@
+describe "The retry statement" do
+ it "raises a SyntaxError if used outside of a block" do
+ lambda { eval "def bad_meth_retry; retry; end" }.should raise_error(SyntaxError)
+ lambda { eval "lambda { retry }.call" }.should raise_error(SyntaxError)
+ end
+end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090323/bdf3603d/attachment.html>
More information about the macruby-changes
mailing list