[macruby-changes] [1958] MacRuby/branches/experimental/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 1 16:46:21 PDT 2009
Revision: 1958
http://trac.macosforge.org/projects/ruby/changeset/1958
Author: eloy.de.enige at gmail.com
Date: 2009-07-01 16:46:20 -0700 (Wed, 01 Jul 2009)
Log Message:
-----------
Updated RubySpec to 27df995656cf18ef2fde2b8fe2b182e2ddfabd30
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/argf/shared/gets.rb
MacRuby/branches/experimental/spec/frozen/core/encoding/find_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/close_write_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb
MacRuby/branches/experimental/spec/frozen/language/break_spec.rb
MacRuby/branches/experimental/spec/frozen/language/loop_spec.rb
MacRuby/branches/experimental/spec/frozen/language/return_spec.rb
MacRuby/branches/experimental/spec/frozen/language/throw_spec.rb
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/core/encoding/_dump_spec.rb
MacRuby/branches/experimental/spec/frozen/core/encoding/_load_spec.rb
Modified: MacRuby/branches/experimental/spec/frozen/core/argf/shared/gets.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/argf/shared/gets.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/argf/shared/gets.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -66,8 +66,8 @@
@tmp1_name_bak = @tmp1_name + ".bak"
@tmp2_name_bak = @tmp2_name + ".bak"
- # File.copy @file1_name, @tmp1_name
- # File.copy @file2_name, @tmp2_name
+ File.copy @file1_name, @tmp1_name
+ File.copy @file2_name, @tmp2_name
method = "ARGF.send(#{@method.inspect})"
@code = "begin while line = #{method} do puts 'x' end rescue EOFError; end"
Deleted: MacRuby/branches/experimental/spec/frozen/core/encoding/_dump_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/encoding/_dump_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/encoding/_dump_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -1,5 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-
-describe "Encoding#_dump" do
- it "needs to be reviewed for spec completeness"
-end
Deleted: MacRuby/branches/experimental/spec/frozen/core/encoding/_load_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/encoding/_load_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/encoding/_load_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -1,5 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-
-describe "Encoding._load" do
- it "needs to be reviewed for spec completeness"
-end
Modified: MacRuby/branches/experimental/spec/frozen/core/encoding/find_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/encoding/find_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/encoding/find_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -1,28 +1,5 @@
require File.dirname(__FILE__) + '/../../spec_helper'
-describe "Encoding.find" do
- it "returns the Encoding instance for the given name" do
- encoding = Encoding.find("UTF-8")
- encoding.should be_kind_of(Encoding)
- encoding.name.should == "UTF-8"
- end
-
- it "raises an ArgumentError if given a name for a non-existing Encoding" do
- lambda {
- Encoding.find("encoding-does-not-exist")
- }.should raise_error(ArgumentError)
- end
-
- it "coerces any object to a String if it responds to #to_str" do
- o = Object.new
- def o.to_str; "UTF-8"; end
-
- Encoding.find(o).name.should == "UTF-8"
- end
-end
-
-require File.dirname(__FILE__) + '/../../spec_helper'
-
ruby_version_is "1.9" do
describe "Encoding.find" do
before(:all) do
Modified: MacRuby/branches/experimental/spec/frozen/core/io/close_write_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/close_write_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/io/close_write_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -2,7 +2,6 @@
require File.dirname(__FILE__) + '/fixtures/classes'
describe "IO#close_write" do
-
before :each do
@io = IO.popen 'cat', 'r+'
@path = tmp('io.close.txt')
@@ -18,51 +17,49 @@
lambda { @io.write "attempt to write" }.should raise_error(IOError)
end
- # it "raises an IOError on subsequent invocations" do
- # @io.close_write
- #
- # lambda { @io.close_write }.should raise_error(IOError)
- # end
- #
- # it "allows subsequent invocation of close" do
- # @io.close_write
- #
- # lambda { @io.close }.should_not raise_error
- # end
- #
- # it "raises an IOError if the stream is readable and not duplexed" do
- # io = File.open @path, 'w+'
- #
- # begin
- # lambda { io.close_write }.should raise_error(IOError)
- # ensure
- # io.close unless io.closed?
- # end
- # File.unlink(@path)
- # end
- #
- # it "closes the stream if it is neither readable nor duplexed" do
- # io = File.open @path, 'w'
- #
- # io.close_write
- #
- # io.closed?.should == true
- # File.unlink @path
- # end
- #
- # it "flushes and closes the write stream" do
- # @io.puts '12345'
- #
- # @io.close_write
- #
- # @io.read.should == "12345\n"
- # end
- #
- # it "raises IOError on closed stream" do
- # @io.close
- #
- # lambda { @io.close_write }.should raise_error(IOError)
- # end
+ it "raises an IOError on subsequent invocations" do
+ @io.close_write
-end
+ lambda { @io.close_write }.should raise_error(IOError)
+ end
+ it "allows subsequent invocation of close" do
+ @io.close_write
+
+ lambda { @io.close }.should_not raise_error
+ end
+
+ it "raises an IOError if the stream is readable and not duplexed" do
+ io = File.open @path, 'w+'
+
+ begin
+ lambda { io.close_write }.should raise_error(IOError)
+ ensure
+ io.close unless io.closed?
+ end
+ File.unlink(@path)
+ end
+
+ it "closes the stream if it is neither readable nor duplexed" do
+ io = File.open @path, 'w'
+
+ io.close_write
+
+ io.closed?.should == true
+ File.unlink @path
+ end
+
+ it "flushes and closes the write stream" do
+ @io.puts '12345'
+
+ @io.close_write
+
+ @io.read.should == "12345\n"
+ end
+
+ it "raises IOError on closed stream" do
+ @io.close
+
+ lambda { @io.close_write }.should raise_error(IOError)
+ end
+end
Modified: MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
Modified: MacRuby/branches/experimental/spec/frozen/language/break_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/break_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/language/break_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -110,8 +110,8 @@
a = loop do break [*[1,2]]; end; a.should == [1,2]
end
- it "assigns splatted objects" do
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "assigns splatted objects" do
a = loop do break *nil; end; a.should == nil
a = loop do break *[]; end; a.should == nil
a = loop do break *1; end; a.should == 1
@@ -121,8 +121,13 @@
a = loop do break *[*[]]; end; a.should == nil
a = loop do break *[1]; end; a.should == 1
a = loop do break *[*[1]]; end; a.should == 1
+ a = loop do break *[1,2]; end; a.should == [1,2]
+ a = loop do break *[*[1,2]]; end; a.should == [1,2]
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "assigns splatted objects" do
a = loop do break *nil; end; a.should == []
a = loop do break *[]; end; a.should == []
a = loop do break *1; end; a.should == [1]
@@ -132,16 +137,16 @@
a = loop do break *[*[]]; end; a.should == []
a = loop do break *[1]; end; a.should == [1]
a = loop do break *[*[1]]; end; a.should == [1]
+ a = loop do break *[1,2]; end; a.should == [1,2]
+ a = loop do break *[*[1,2]]; end; a.should == [1,2]
end
- a = loop do break *[1,2]; end; a.should == [1,2]
- a = loop do break *[*[1,2]]; end; a.should == [1,2]
end
- it "assigns to a splatted reference" do
- *a = loop do break; end; a.should == [nil]
- *a = loop do break nil; end; a.should == [nil]
- *a = loop do break 1; end; a.should == [1]
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "assigns to a splatted reference" do
+ *a = loop do break; end; a.should == [nil]
+ *a = loop do break nil; end; a.should == [nil]
+ *a = loop do break 1; end; a.should == [1]
*a = loop do break []; end; a.should == [[]]
*a = loop do break [1]; end; a.should == [[1]]
*a = loop do break [nil]; end; a.should == [[nil]]
@@ -151,7 +156,13 @@
*a = loop do break [*[1]]; end; a.should == [[1]]
*a = loop do break [*[1,2]]; end; a.should == [[1,2]]
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "assigns to a splatted reference" do
+ *a = loop do break; end; a.should == [nil]
+ *a = loop do break nil; end; a.should == [nil]
+ *a = loop do break 1; end; a.should == [1]
*a = loop do break []; end; a.should == []
*a = loop do break [1]; end; a.should == [1]
*a = loop do break [nil]; end; a.should == [nil]
@@ -163,47 +174,64 @@
end
end
- it "assigns splatted objects to a splatted reference" do
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "assigns splatted objects to a splatted reference" do
*a = loop do break *nil; end; a.should == [nil]
*a = loop do break *[]; end; a.should == [nil]
*a = loop do break *[1,2]; end; a.should == [[1,2]]
*a = loop do break *[*[]]; end; a.should == [nil]
*a = loop do break *[*[1,2]]; end; a.should == [[1,2]]
+ *a = loop do break *1; end; a.should == [1]
+ *a = loop do break *[1]; end; a.should == [1]
+ *a = loop do break *[nil]; end; a.should == [nil]
+ *a = loop do break *[[]]; end; a.should == [[]]
+ *a = loop do break *[*[1]]; end; a.should == [1]
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "assigns splatted objects to a splatted reference" do
*a = loop do break *nil; end; a.should == []
*a = loop do break *[]; end; a.should == []
*a = loop do break *[1,2]; end; a.should == [1,2]
*a = loop do break *[*[]]; end; a.should == []
*a = loop do break *[*[1,2]]; end; a.should == [1,2]
+ *a = loop do break *1; end; a.should == [1]
+ *a = loop do break *[1]; end; a.should == [1]
+ *a = loop do break *[nil]; end; a.should == [nil]
+ *a = loop do break *[[]]; end; a.should == [[]]
+ *a = loop do break *[*[1]]; end; a.should == [1]
end
- *a = loop do break *1; end; a.should == [1]
- *a = loop do break *[1]; end; a.should == [1]
- *a = loop do break *[nil]; end; a.should == [nil]
- *a = loop do break *[[]]; end; a.should == [[]]
- *a = loop do break *[*[1]]; end; a.should == [1]
end
- it "assigns splatted objects to a splatted reference from a splatted loop" do
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "assigns splatted objects to a splatted reference from a splatted loop" do
*a = *loop do break *nil; end; a.should == [nil]
*a = *loop do break *[]; end; a.should == [nil]
*a = *loop do break *[[]]; end; a.should == []
*a = *loop do break *[*[]]; end; a.should == [nil]
+ *a = *loop do break *1; end; a.should == [1]
+ *a = *loop do break *[1]; end; a.should == [1]
+ *a = *loop do break *[nil]; end; a.should == [nil]
+ *a = *loop do break *[1,2]; end; a.should == [1,2]
+ *a = *loop do break *[*[1]]; end; a.should == [1]
+ *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "assigns splatted objects to a splatted reference from a splatted loop" do
*a = *loop do break *nil; end; a.should == []
*a = *loop do break *[]; end; a.should == []
*a = *loop do break *[[]]; end; a.should == [[]]
*a = *loop do break *[*[]]; end; a.should == []
+ *a = *loop do break *1; end; a.should == [1]
+ *a = *loop do break *[1]; end; a.should == [1]
+ *a = *loop do break *[nil]; end; a.should == [nil]
+ *a = *loop do break *[1,2]; end; a.should == [1,2]
+ *a = *loop do break *[*[1]]; end; a.should == [1]
+ *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
end
- *a = *loop do break *1; end; a.should == [1]
- *a = *loop do break *[1]; end; a.should == [1]
- *a = *loop do break *[nil]; end; a.should == [nil]
- *a = *loop do break *[1,2]; end; a.should == [1,2]
- *a = *loop do break *[*[1]]; end; a.should == [1]
- *a = *loop do break *[*[1,2]]; end; a.should == [1,2]
end
it "assigns objects to multiple block variables" do
@@ -220,55 +248,85 @@
a,b,*c = loop do break [*[1,2]]; end; [a,b,c].should == [1,2,[]]
end
- it "assigns splatted objects to multiple block variables" do
- a,b,*c = loop do break *nil; end; [a,b,c].should == [nil,nil,[]]
- a,b,*c = loop do break *1; end; [a,b,c].should == [1,nil,[]]
- a,b,*c = loop do break *[]; end; [a,b,c].should == [nil,nil,[]]
- a,b,*c = loop do break *[1]; end; [a,b,c].should == [1,nil,[]]
- a,b,*c = loop do break *[nil]; end; [a,b,c].should == [nil,nil,[]]
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "assigns splatted objects to multiple block variables" do
+ a,b,*c = loop do break *nil; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *1; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[]; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *[1]; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[nil]; end; [a,b,c].should == [nil,nil,[]]
a,b,*c = loop do break *[[]]; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *[1,2]; end; [a,b,c].should == [1,2,[]]
+ a,b,*c = loop do break *[*[]]; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *[*[1]]; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "assigns splatted objects to multiple block variables" do
+ a,b,*c = loop do break *nil; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *1; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[]; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *[1]; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[nil]; end; [a,b,c].should == [nil,nil,[]]
a,b,*c = loop do break *[[]]; end; [a,b,c].should == [[],nil,[]]
+ a,b,*c = loop do break *[1,2]; end; [a,b,c].should == [1,2,[]]
+ a,b,*c = loop do break *[*[]]; end; [a,b,c].should == [nil,nil,[]]
+ a,b,*c = loop do break *[*[1]]; end; [a,b,c].should == [1,nil,[]]
+ a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
end
- a,b,*c = loop do break *[1,2]; end; [a,b,c].should == [1,2,[]]
- a,b,*c = loop do break *[*[]]; end; [a,b,c].should == [nil,nil,[]]
- a,b,*c = loop do break *[*[1]]; end; [a,b,c].should == [1,nil,[]]
- a,b,*c = loop do break *[*[1,2]]; end; [a,b,c].should == [1,2,[]]
end
- it "stops any loop type at the correct spot" do
- i = 0; loop do break i if i == 2; i+=1; end.should == 2
- i = 0; loop do break if i == 3; i+=1; end; i.should == 3
- i = 0; 0.upto(5) {|i| break i if i == 2 }.should == 2
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "stops any loop type at the correct spot" do
+ i = 0; loop do break i if i == 2; i+=1; end.should == 2
+ i = 0; loop do break if i == 3; i+=1; end; i.should == 3
+ i = 0; 0.upto(5) {|i| break i if i == 2 }.should == 2
i = 0; 0.upto(5) {|i| break if i == 3 }; i.should == 3
+ i = 0; while (i < 5) do break i if i == 2 ; i+=1; end.should == 2
+ i = 0; while (i < 5) do break if i == 3 ; i+=1; end; i.should == 3
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "stops any loop type at the correct spot" do
+ i = 0; loop do break i if i == 2; i+=1; end.should == 2
+ i = 0; loop do break if i == 3; i+=1; end; i.should == 3
+ i = 0; 0.upto(5) {|i| break i if i == 2 }.should == 2
i = 0; 0.upto(5) {|i| break if i == 3 }; i.should == 0
+ i = 0; while (i < 5) do break i if i == 2 ; i+=1; end.should == 2
+ i = 0; while (i < 5) do break if i == 3 ; i+=1; end; i.should == 3
end
- i = 0; while (i < 5) do break i if i == 2 ; i+=1; end.should == 2
- i = 0; while (i < 5) do break if i == 3 ; i+=1; end; i.should == 3
end
- it "stops a yielded method at the correct spot" do
- def break_test()
- yield 1
- yield 2
- yield 3
- end
- break_test {|i| break i if i == 2 }.should == 2
- i = 0
- break_test {|i| break i if i == 1 }
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
+ it "stops a yielded method at the correct spot" do
+ def break_test()
+ yield 1
+ yield 2
+ yield 3
+ end
+ break_test {|i| break i if i == 2 }.should == 2
+ i = 0
+ break_test {|i| break i if i == 1 }
i.should == 1
end
- ruby_version_is "1.9" do
+ end
+
+ ruby_version_is "1.9" do
+ it "stops a yielded method at the correct spot" do
+ def break_test()
+ yield 1
+ yield 2
+ yield 3
+ end
+ break_test {|i| break i if i == 2 }.should == 2
+ i = 0
+ break_test {|i| break i if i == 1 }
i.should == 0
end
end
-
end
language_version __FILE__, "break"
Modified: MacRuby/branches/experimental/spec/frozen/language/loop_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/loop_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/language/loop_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -1,7 +1,6 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe "The loop expression" do
-
it "repeats the given block until a break is called" do
outer_loop = 0
loop do
@@ -10,7 +9,7 @@
end
outer_loop.should == 10
end
-
+
it "executes code in its own scope" do
loop do
inner_loop = 123
@@ -18,13 +17,13 @@
end
lambda { inner_loop }.should raise_error(NameError)
end
-
+
it "returns the value passed to break if interrupted by break" do
loop do
break 123
end.should == 123
end
-
+
it "returns nil if interrupted by break with no arguments" do
loop do
break
@@ -41,18 +40,18 @@
end
a.should == [1, 2, 4]
end
-
+
it "restarts the current iteration with redo" do
a = []
loop do
a << 1
redo if a.size < 2
a << 2
- break if a.size == 3
+ break if a.size == 3
end
a.should == [1, 1, 2]
end
-
+
it "uses a spaghetti nightmare of redo, next and break" do
a = []
loop do
Modified: MacRuby/branches/experimental/spec/frozen/language/return_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/return_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/language/return_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -22,7 +22,6 @@
r().should be_nil
end
-
describe "in a Thread" do
ruby_version_is "" ... "1.9" do
it "raises a ThreadError if used to exit a thread" do
@@ -88,44 +87,11 @@
end
end
+
it "calls 'to_a' on the splatted value first" do
def r
obj = Object.new
def obj.to_a
- []
- end
-
- return *obj
- end
-
- ruby_version_is "" ... "1.9" do
- r().should be_nil
- end
-
- ruby_version_is "1.9" do
- r().should == []
- end
-
- def r
- obj = Object.new
- def obj.to_a
- [1]
- end
-
- return *obj
- end
-
- ruby_version_is "" ... "1.9" do
- r().should == 1
- end
-
- ruby_version_is "1.9" do
- r().should == [1]
- end
-
- def r
- obj = Object.new
- def obj.to_a
[1,2]
end
@@ -140,40 +106,17 @@
def r
obj = Object.new
def obj.to_ary
- []
- end
-
- return *obj
- end
-
- r().should be_nil
-
- def r
- obj = Object.new
- def obj.to_ary
- [1]
- end
-
- return *obj
- end
-
- r().should == 1
-
- def r
- obj = Object.new
- def obj.to_ary
[1,2]
end
-
+
return *obj
end
-
+
r().should == [1,2]
end
end
end
-
describe "within a begin" do
it "executes ensure before returning from function" do
def f(a)
@@ -233,7 +176,6 @@
end
end
-
describe "within a block" do
before :each do
ScratchPad.clear
@@ -282,5 +224,4 @@
f.should be_true
end
end
-
end
Modified: MacRuby/branches/experimental/spec/frozen/language/throw_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/throw_spec.rb 2009-07-01 23:43:49 UTC (rev 1957)
+++ MacRuby/branches/experimental/spec/frozen/language/throw_spec.rb 2009-07-01 23:46:20 UTC (rev 1958)
@@ -9,7 +9,7 @@
throw :done if i > 4
end
i += 1
- end
+ end
i.should == 5
end
@@ -29,8 +29,8 @@
ruby_version_is "" ... "1.9" do
it "only allows symbols and strings as its argument" do
- lambda { throw 1 }.should raise_error(ArgumentError)
- lambda { throw Object.new }.should raise_error(TypeError)
+ lambda { throw 1 }.should raise_error(ArgumentError)
+ lambda { throw Object.new }.should raise_error(TypeError)
end
end
@@ -54,7 +54,7 @@
lambda { catch(:exit) { throw "exit" } }.should raise_error(ArgumentError)
end
end
-
+
it "unwinds stack from within a method" do
def throw_method(handler,val)
throw handler,val
@@ -71,20 +71,20 @@
end
ruby_version_is "" ... "1.9" do
- it "raises a NameError if outside of scope of a matching catch" do
+ it "raises a NameError if outside of scope of a matching catch" do
lambda { throw :test,5 }.should raise_error(NameError)
lambda { catch(:different) { throw :test,5 } }.should raise_error(NameError)
end
end
- ruby_version_is "1.9" do
- it "raises an ArgumentError if outside of scope of a matching catch" do
+ ruby_version_is "1.9" do
+ it "raises an ArgumentError if outside of scope of a matching catch" do
lambda { throw :test,5 }.should raise_error(ArgumentError)
lambda { catch(:different) { throw :test,5 } }.should raise_error(ArgumentError)
end
end
- ruby_version_is "" ... "1.9" do
+ ruby_version_is "" ... "1.9" do
it "raises a ThreadError if used to exit a thread" do
lambda {
catch(:what) do
@@ -95,8 +95,8 @@
}.should raise_error(ThreadError)
end
end
-
- ruby_version_is "1.9" do
+
+ ruby_version_is "1.9" do
it "raises a ArgumentError if used to exit a thread" do
lambda {
catch(:what) do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090701/935ffce6/attachment-0001.html>
More information about the macruby-changes
mailing list