[macruby-changes] [2812] MacRuby/trunk/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 15 13:10:21 PDT 2009
Revision: 2812
http://trac.macosforge.org/projects/ruby/changeset/2812
Author: eloy.de.enige at gmail.com
Date: 2009-10-15 13:10:20 -0700 (Thu, 15 Oct 2009)
Log Message:
-----------
Revert "Updated RubySpec to 2d102bae115e11719ff355d99ef336c0889b769a"
This reverts commit a2a39ce693f60a474d2269d81ff66c6b6414de30.
For some reason this causes the mspec :full task to skip most specs.
No idea why, need to investigate more...
Modified Paths:
--------------
MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb
MacRuby/trunk/spec/frozen/core/exception/system_call_error_spec.rb
MacRuby/trunk/spec/frozen/core/file/new_spec.rb
MacRuby/trunk/spec/frozen/core/file/open_spec.rb
MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb
MacRuby/trunk/spec/frozen/core/fixnum/divide_spec.rb
MacRuby/trunk/spec/frozen/core/fixnum/right_shift_spec.rb
MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
MacRuby/trunk/spec/frozen/core/io/inspect_spec.rb
MacRuby/trunk/spec/frozen/core/io/output_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/exit_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb
MacRuby/trunk/spec/frozen/core/random/rand_spec.rb
MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb
MacRuby/trunk/spec/frozen/core/string/try_convert_spec.rb
MacRuby/trunk/spec/frozen/core/string/upto_spec.rb
MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb
MacRuby/trunk/spec/frozen/language/hash_spec.rb
MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb
MacRuby/trunk/spec/frozen/language/return_spec.rb
MacRuby/trunk/spec/frozen/library/getoptlong/error_message_spec.rb
MacRuby/trunk/spec/frozen/library/getoptlong/ordering_spec.rb
MacRuby/trunk/spec/frozen/library/getoptlong/shared/get.rb
MacRuby/trunk/spec/frozen/library/mutex/lock_spec.rb
MacRuby/trunk/spec/frozen/library/mutex/try_lock_spec.rb
MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb
MacRuby/trunk/spec/frozen/library/socket/fixtures/classes.rb
MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb
MacRuby/trunk/spec/frozen/library/zlib/deflate/params_spec.rb
MacRuby/trunk/spec/frozen/library/zlib/inflate/append_spec.rb
MacRuby/trunk/spec/frozen/library/zlib/inflate/inflate_spec.rb
MacRuby/trunk/spec/frozen/shared/rational/div.rb
MacRuby/trunk/spec/frozen/tags/1.9/core/argf/bytes_tags.txt
MacRuby/trunk/spec/frozen/tags/1.9/core/argf/chars_tags.txt
MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_byte_tags.txt
MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_char_tags.txt
MacRuby/trunk/spec/frozen/upstream
Added Paths:
-----------
MacRuby/trunk/spec/frozen/library/date/neww_spec.rb
MacRuby/trunk/spec/frozen/tags/1.9/core/argf/lineno_tags.txt
Removed Paths:
-------------
MacRuby/trunk/spec/frozen/core/file/shared/open.rb
MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb
MacRuby/trunk/spec/frozen/library/delegate/fixtures/classes.rb
MacRuby/trunk/spec/frozen/library/delegate/method_spec.rb
MacRuby/trunk/spec/frozen/library/delegate/send_spec.rb
Modified: MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/binding/eval_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -9,7 +9,8 @@
bind2 = obj.dup.get_binding
{ "@secret += square(3)" => 10,
"a" => true,
- "class Inside ; end ; Inside.name" => "BindingSpecs::Demo::Inside"
+ "class Inside ; end" => nil,
+ "Inside.name" => "BindingSpecs::Demo::Inside"
}.each do |test, result|
r1 = bind1.eval(test)
r2 = Kernel.eval(test, bind2)
Modified: MacRuby/trunk/spec/frozen/core/exception/system_call_error_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/exception/system_call_error_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/exception/system_call_error_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -14,15 +14,6 @@
SystemCallError.new(42).errno.should == 42
SystemCallError.new(2**24).errno.should == 2**24
end
-
- it "constructs the appropriate Errno class" do
- # EINVAL should be more or less mortable across the platforms,
- # so let's use it then.
- SystemCallError.new(22).should be_kind_of(SystemCallError)
- SystemCallError.new(22).should be_an_instance_of(Errno::EINVAL)
-
- SystemCallError.new(2**28).should be_an_instance_of(SystemCallError)
- end
end
describe "SystemCallError#errno" do
Modified: MacRuby/trunk/spec/frozen/core/file/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/new_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/file/new_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,5 +1,4 @@
require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/shared/open'
describe "File.new" do
before :each do
@@ -155,6 +154,4 @@
lambda { File.new(@fh.fileno, @flags) }.should raise_error(Errno::EINVAL)
end
end
-
- it_behaves_like :open_directory, :new
end
Modified: MacRuby/trunk/spec/frozen/core/file/open_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/open_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/file/open_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,5 +1,4 @@
require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/shared/open'
describe "File.open" do
before :all do
@@ -543,6 +542,4 @@
it "raises an ArgumentError if passed an invalid string for mode" do
lambda { File.open(@file, 'fake') }.should raise_error(ArgumentError)
end
-
- it_behaves_like :open_directory, :open
end
Deleted: MacRuby/trunk/spec/frozen/core/file/shared/open.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/shared/open.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/file/shared/open.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../../dir/fixtures/common'
-
-describe :open_directory, :shared => true do
- it "opens directories" do
- lambda { File.send(@method, DirSpecs.mock_dir) }.should_not raise_error
- File.directory?(DirSpecs.mock_dir).should == true
- end
-end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/file/truncate_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -94,7 +94,7 @@
platform_is_not :windows do
it "truncates an absolute pathname file" do
- absolute_pathname_file = tmp("#{@name}")
+ absolute_pathname_file = "/tmp/#{@name}"
File.open(absolute_pathname_file,"w") { |f| f.write("1234567890") }
File.truncate(absolute_pathname_file, 5)
File.size(absolute_pathname_file).should == 5
Modified: MacRuby/trunk/spec/frozen/core/fixnum/divide_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fixnum/divide_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/fixnum/divide_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -5,10 +5,6 @@
(2 / 2).should == 1
(3 / 2).should == 1
end
-
- it "supports dividing negative numbers" do
- (-1 / 10).should == -1
- end
it "raises a ZeroDivisionError if the given argument is zero and not a Float" do
lambda { 1 / 0 }.should raise_error(ZeroDivisionError)
Modified: MacRuby/trunk/spec/frozen/core/fixnum/right_shift_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/fixnum/right_shift_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/fixnum/right_shift_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -43,11 +43,5 @@
(-3 >> obj).should == -1
end
- it "wraps to 0 when shifting all bits off" do
- # test for both Fixnum size boundaries
- (5 >> 32).should == 0
- (5 >> 64).should == 0
- end
-
end
Modified: MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/io/fixtures/classes.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -32,9 +32,4 @@
}
end
- class NotConvertable
- def to_io
- raise TypeError
- end
- end
end
Modified: MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/gets_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/io/gets_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -174,7 +174,6 @@
f.fileno.should == g.fileno
lambda { g.gets }.should raise_error(IOError)
g.close
- lambda { f.close }.should raise_error(Errno::EBADF)
File.unlink(tmp("gets_specs"))
end
Modified: MacRuby/trunk/spec/frozen/core/io/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/inspect_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/io/inspect_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -7,16 +7,13 @@
end
after :each do
- @file.close if !@file.closed?
+ @file.close
File.unlink(tmp("inspect_spec"))
end
it "returns a string describing a stream" do
# don't hardcode the tmp path
@file.inspect.should =~ /#<File.*inspect_spec>/
- io = IO.new(@file.to_i)
- io.inspect.should =~ /<IO:[\w\s?\d]+>/
- io.close
- lambda { @file.close }.should raise_error(Errno::EBADF)
+ IO.new(@file.to_i).inspect.should =~ /<IO:[\w\s?\d]+>/
end
end
Modified: MacRuby/trunk/spec/frozen/core/io/output_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/output_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/io/output_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -18,10 +18,4 @@
io = IOSpecs.closed_file
lambda { io << "test" }.should raise_error(IOError)
end
-
- it "returns self" do
- lambda {
- ($stderr << "to_stderr").should == $stderr
- }.should output(nil, "to_stderr")
- end
end
Deleted: MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/io/try_convert_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,36 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes'
-
-describe "IO.try_convert" do
- ruby_version_is "1.9" do
- it "returns self for IO objects" do
- fd_1 = IO.new(1)
- IO.try_convert(fd_1).should equal(fd_1)
- end
-
- it "converts using :to_io" do
- io = File.new(__FILE__)
- obj = mock('ioish')
- obj.should_receive(:to_io).and_return(io)
- IO.try_convert(obj).should equal(io)
- end
-
- it "returns nil when the argument doesn't respond to :to_io" do
- IO.try_convert(-1).should be_nil
- end
-
- it "should not rescue errors" do
- lambda{
- IO.try_convert(IOSpecs::NotConvertible.new)
- }.should raise_error
- end
-
- it "checks the result of the conversion" do
- obj = mock('middle child')
- obj.should_receive(:to_io).and_return(:confused)
- lambda{
- IO.try_convert(obj)
- }.should raise_error(TypeError)
- end
- end
-end
Modified: MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -493,10 +493,6 @@
lambda { Integer("0#{d}1", base) }.should raise_error(ArgumentError)
end
end
-
- it "raises an ArgumentError if a base is given for a non-String value" do
- lambda { Integer(98, 15) }.should raise_error(ArgumentError)
- end
end
end
Modified: MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/kernel/eval_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,8 +1,15 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
-EvalSpecs::A.new.c
+class A
+ eval "class B; end"
+ def c
+ eval "class C; end"
+ end
+end
+A.new.c
+
describe "Kernel#eval" do
it "is a private method" do
Kernel.should have_private_instance_method(:eval)
@@ -17,53 +24,13 @@
end
it "evaluates within the scope of the eval" do
- EvalSpecs::A::B.name.should == "EvalSpecs::A::B"
+ A::B.name.should == "A::B"
end
it "evaluates such that consts are scoped to the class of the eval" do
- EvalSpecs::A::C.name.should == "EvalSpecs::A::C"
+ A::C.name.should == "A::C"
end
- it "finds a local in an enclosing scope" do
- a = 1
- eval("a").should == 1
- end
-
- it "updates a local in an enclosing scope" do
- a = 1
- eval("a = 2").should == 2
- a.should == 2
- end
-
- it "creates an eval-scope local" do
- eval("eval_only_local = 1; eval_only_local").should == 1
- lambda { eval_only_local }.should raise_error(NameError)
- end
-
- it "updates a local in a surrounding block scope" do
- EvalSpecs.new.f do
- a = 1
- eval("a = 2").should == 2
- a.should == 2
- end
- end
-
- it "updates a local in a scope above a surrounding block scope" do
- a = 1
- EvalSpecs.new.f do
- eval("a = 2").should == 2
- a.should == 2
- end
- a.should == 2
- end
-
- it "updates a local in a scope above when modified in a nested block scope" do
- a = 1
- es = EvalSpecs.new
- eval("es.f { es.f { a = 2 } }").should == 2
- a.should == 2
- end
-
ruby_version_is ""..."1.9" do
it "accepts a Proc object as a binding" do
x = 1
Modified: MacRuby/trunk/spec/frozen/core/kernel/exit_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/exit_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/kernel/exit_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -13,75 +13,9 @@
end
end
-describe "Kernel.exit" do
- before :each do
- ScratchPad.clear
- end
- it "raises a SystemExit with status 0" do
- begin
- exit
- ScratchPad.record :no_exit
- rescue SystemExit => e
- e.status.should == 0
- end
- ScratchPad.recorded.should be_nil
- end
-
- it "raises a SystemExit with the specified status" do
- [-2**16, -2**8, -8, -1, 0, 1 , 8, 2**8, 2**16].each { |value|
- begin
- exit(value)
- ScratchPad.record :no_exit
- rescue SystemExit => e
- e.status.should == value
- end
- ScratchPad.recorded.should be_nil
- }
- end
-
- it "raises a SystemExit with the specified boolean status" do
- { true => 0, false => 1 }.each { |value, status|
- begin
- exit(value)
- ScratchPad.record :no_exit
- rescue SystemExit => e
- e.status.should == status
- end
- ScratchPad.recorded.should be_nil
- }
- end
-
- it "tries to convert the passed argument to an Integer using #to_int" do
- obj = mock('5')
- obj.should_receive(:to_int).and_return(5)
- begin
- exit(obj)
- ScratchPad.record :no_exit
- rescue SystemExit => e
- e.status.should == 5
- end
- ScratchPad.recorded.should be_nil
- end
-
- it "converts the passed Float argument to an Integer" do
- { -2.2 => -2, -0.1 => 0, 5.5 => 5, 827.999 => 827 }.each { |value, status|
- begin
- exit(value)
- ScratchPad.record :no_exit
- rescue SystemExit => e
- e.status.should == status
- end
- ScratchPad.recorded.should be_nil
- }
- end
-
- it "raises TypeError if can't convert the argument to an Integer" do
- lambda { exit(Object.new) }.should raise_error(TypeError)
- lambda { exit('0') }.should raise_error(TypeError)
- lambda { exit([0]) }.should raise_error(TypeError)
- lambda { exit(nil) }.should raise_error(TypeError)
- end
+describe "Kernel.exit" do
+ it "needs to be reviewed for spec completeness"
end
describe "Kernel.exit!" do
Modified: MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -229,19 +229,6 @@
end
end
-class EvalSpecs
- class A
- eval "class B; end"
- def c
- eval "class C; end"
- end
- end
-
- def f
- yield
- end
-end
-
# for Kernel#sleep to have Channel in it's specs
# TODO: switch directly to queue for both Kernel#sleep and Thread specs?
unless defined? Channel
Modified: MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/kernel/taint_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -7,7 +7,7 @@
end
it "has no effect on immediate values" do
- imediate_values = [nil, true, false, 1, :sym]
- imediate_values.each{ |v| v.taint; v.tainted?.should be_false}
+ inmediate_values = [a = nil, b = true, c = false, d = 1, e = "a string"]
+ inmediate_values.each{ |v| v.tainted?.should == false}
end
end
Modified: MacRuby/trunk/spec/frozen/core/random/rand_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/random/rand_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/random/rand_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -93,7 +93,7 @@
describe "Random#rand with Bignum" do
it "returns a Bignum" do
- Random.new(1).rand(bignum_value).should be_an_instance_of(Bignum)
+ Random.new.rand(bignum_value).should be_an_instance_of(Bignum)
end
it "returns a Bignum greater than or equal to 0" do
Modified: MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -15,7 +15,7 @@
end
it "returns a string with nonprinting, non-ASCII characters replaced by \\u notation for Unicode strings" do
- (127..150).map{|o| o.chr('utf-8')}.to_a.join('').inspect.should == "\"\\u007F\\u0080\\u0081\\u0082\\u0083\\u0084\\u0085\\u0086\\u0087\\u0088\\u0089\\u008A\\u008B\\u008C\\u008D\\u008E\\u008F\\u0090\\u0091\\u0092\\u0093\\u0094\\u0095\\u0096\""
+ (127..150).map{|o| o.chr('utf-8')}.to_a.join('').inspect.should == "\"\\u007F\\u0080\\u0081\\u0082\\u0083\\u0084\u0085\\u0086\\u0087\\u0088\\u0089\\u008A\\u008B\\u008C\\u008D\\u008E\\u008F\\u0090\\u0091\\u0092\\u0093\\u0094\\u0095\\u0096\""
end
end
Modified: MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/string/modulo_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -440,11 +440,21 @@
end
ruby_version_is "1.9" do
- it "pads with spaces for %E with Inf, -Inf, and NaN" do
- ("%010E" % -1e1020).should == " -Inf"
- ("%010E" % 1e1020).should == " Inf"
- ("%010E" % (0.0/0)).should == " NaN"
+ platform_is :darwin do
+ it "pads with zeros using %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == "-000000Inf"
+ ("%010E" % 1e1020).should == "0000000Inf"
+ ("%010E" % (0.0/0)).should == "0000000NaN"
+ end
end
+
+ platform_is_not :darwin do
+ it "pads with spaces for %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == " -Inf"
+ ("%010E" % 1e1020).should == " Inf"
+ ("%010E" % (0.0/0)).should == " NaN"
+ end
+ end
end
end
Modified: MacRuby/trunk/spec/frozen/core/string/try_convert_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/try_convert_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/string/try_convert_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -15,7 +15,7 @@
String.try_convert(obj).should equal(str)
end
- it "returns nil when there is no :to_str" do
+ it "returns nil when there is no :to_ary" do
String.try_convert(-1).should be_nil
end
@@ -33,4 +33,4 @@
}.should raise_error(TypeError)
end
end
-end
+end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/core/string/upto_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/upto_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/string/upto_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -14,23 +14,13 @@
a.should == ["abc"]
end
- # This is weird (in 1.8), but MRI behaves like that
- ruby_version_is '' ... '1.9' do
- it "calls block with self even if self is less than stop but stop length is less than self length" do
- a = []
- "25".upto("5") { |s| a << s }
- a.should == ["25"]
- end
+ # This is weird but MRI behaves like that
+ it "calls block with self even if self is less than stop but stop length is less than self length" do
+ a = []
+ "25".upto("5") { |s| a << s }
+ a.should == ["25"]
end
- ruby_version_is '1.9' do
- it "doesn't call block with self even if self is less than stop but stop length is less than self length" do
- a = []
- "25".upto("5") { |s| a << s }
- a.should == []
- end
- end
-
it "doesn't call block if stop is less than self and stop length is less than self length" do
a = []
"25".upto("1") { |s| a << s }
Modified: MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/core/thread/raise_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -50,8 +50,8 @@
lambda {t.value}.should raise_error(RuntimeError)
end
- ruby_version_is "1.9" do
- it "raises a RuntimeError when called with no arguments" do
+ ruby_version_is "" ... "1.9" do
+ it "re-raises active exception" do
t = Thread.new do
begin
1/0
@@ -59,13 +59,10 @@
sleep 3
end
end
- begin
- raise RangeError
- rescue
- Thread.pass while t.status and t.status != "sleep"
- t.raise
- end
- lambda {t.value}.should raise_error(RuntimeError)
+
+ Thread.pass while t.status and t.status != "sleep"
+ t.raise
+ lambda {t.value}.should raise_error(ZeroDivisionError)
t.kill
end
end
@@ -110,25 +107,23 @@
lambda {t.value}.should raise_error(RuntimeError)
end
- it "raise the given argument even when there is an active exception" do
- raised = false
- t = Thread.new do
- begin
- 1/0
- rescue ZeroDivisionError
- raised = true
- loop { }
+ ruby_version_is "" ... "1.9" do
+ it "re-raises active exception" do
+ raised = false
+ t = Thread.new do
+ begin
+ 1/0
+ rescue ZeroDivisionError
+ raised = true
+ loop { }
+ end
end
- end
- begin
- raise "Create an active exception for the current thread too"
- rescue
+
Thread.pass until raised || !t.alive?
- t.raise RangeError
- lambda {t.value}.should raise_error(RangeError)
+ t.raise
+ lambda {t.value}.should raise_error(ZeroDivisionError)
end
end
-
end
describe "Thread#raise on same thread" do
Modified: MacRuby/trunk/spec/frozen/language/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/hash_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/language/hash_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -38,10 +38,4 @@
h.keys.first.frozen?.should == true
key.should == "oof"
end
-
- it "checks duplicated keys on initialization" do
- h = {:foo => :bar, :foo => :foo}
- h.keys.size.should == 1
- h.should == {:foo => :foo}
- end
end
Modified: MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -13,51 +13,17 @@
match.to_a.should == ["\303\251"]
end
- it 'supports /e (EUC encoding) with interpolation' do
- match = /#{/./}/e.match("\303\251")
- match.to_a.should == ["\303\251"]
- end
-
- it 'supports /e (EUC encoding) with interpolation and /o' do
- match = /#{/./}/e.match("\303\251")
- match.to_a.should == ["\303\251"]
- end
-
it 'supports /n (Normal encoding)' do
/./n.match("\303\251").to_a.should == ["\303"]
end
- it 'supports /n (Normal encoding) with interpolation' do
- /#{/./}/n.match("\303\251").to_a.should == ["\303"]
- end
-
- it 'supports /n (Normal encoding) with interpolation and /o' do
- /#{/./}/no.match("\303\251").to_a.should == ["\303"]
- end
-
it 'supports /s (SJIS encoding)' do
/./s.match("\303\251").to_a.should == ["\303"]
end
- it 'supports /s (SJIS encoding) with interpolation' do
- /#{/./}/s.match("\303\251").to_a.should == ["\303"]
- end
-
- it 'supports /s (SJIS encoding) with interpolation and /o' do
- /#{/./}/so.match("\303\251").to_a.should == ["\303"]
- end
-
it 'supports /u (UTF8 encoding)' do
/./u.match("\303\251").to_a.should == ["\303\251"]
end
-
- it 'supports /u (UTF8 encoding) with interpolation' do
- /#{/./}/u.match("\303\251").to_a.should == ["\303\251"]
- end
-
- it 'supports /u (UTF8 encoding) with interpolation and /o' do
- /#{/./}/uo.match("\303\251").to_a.should == ["\303\251"]
- end
it 'selects last of multiple encoding specifiers' do
/foo/ensuensuens.should == /foo/s
@@ -71,55 +37,19 @@
match.to_a.should == ["\303\251".force_encoding(Encoding::EUC_JP)]
end
- it 'supports /e (EUC encoding) with interpolation' do
- match = /#{/./}/e.match("\303\251".force_encoding(Encoding::EUC_JP))
- match.to_a.should == ["\303\251".force_encoding(Encoding::EUC_JP)]
- end
-
- it 'supports /e (EUC encoding) with interpolation /o' do
- match = /#{/./}/e.match("\303\251".force_encoding(Encoding::EUC_JP))
- match.to_a.should == ["\303\251".force_encoding(Encoding::EUC_JP)]
- end
-
it 'supports /n (No encoding)' do
/./n.match("\303\251").to_a.should == ["\303"]
end
- it 'supports /n (No encoding) with interpolation' do
- /#{/./}/n.match("\303\251").to_a.should == ["\303"]
- end
-
- it 'supports /n (No encoding) with interpolation /o' do
- /#{/./}/n.match("\303\251").to_a.should == ["\303"]
- end
-
it 'supports /s (Windows_31J encoding)' do
match = /./s.match("\303\251".force_encoding(Encoding::Windows_31J))
match.to_a.should == ["\303".force_encoding(Encoding::Windows_31J)]
end
- it 'supports /s (Windows_31J encoding) with interpolation' do
- match = /#{/./}/s.match("\303\251".force_encoding(Encoding::Windows_31J))
- match.to_a.should == ["\303".force_encoding(Encoding::Windows_31J)]
- end
-
- it 'supports /s (Windows_31J encoding) with interpolation and /o' do
- match = /#{/./}/s.match("\303\251".force_encoding(Encoding::Windows_31J))
- match.to_a.should == ["\303".force_encoding(Encoding::Windows_31J)]
- end
-
it 'supports /u (UTF8 encoding)' do
/./u.match("\303\251".force_encoding('utf-8')).to_a.should == ["\u{e9}"]
end
- it 'supports /u (UTF8 encoding) with interpolation' do
- /#{/./}/u.match("\303\251".force_encoding('utf-8')).to_a.should == ["\u{e9}"]
- end
-
- it 'supports /u (UTF8 encoding) with interpolation and /o' do
- /#{/./}/u.match("\303\251".force_encoding('utf-8')).to_a.should == ["\u{e9}"]
- end
-
# Fails on 1.9; reported as bug #2052
it 'selects last of multiple encoding specifiers' do
/foo/ensuensuens.should == /foo/s
Modified: MacRuby/trunk/spec/frozen/language/return_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/return_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/language/return_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -201,17 +201,6 @@
f().should == :outer_ensure
ScratchPad.recorded.should == [:inner_begin, :inner_ensure, :outer_ensure]
end
-
- it "executes the ensure clause when begin/ensure are inside a lambda" do
- lambda do
- begin
- return
- ensure
- ScratchPad.recorded << :ensure
- end
- end.call
- ScratchPad.recorded.should == [:ensure]
- end
end
describe "within a block" do
@@ -252,7 +241,6 @@
ReturnSpecs::NestedBlocks.new.enclosing_method.should == :return_value
ScratchPad.recorded.should == :before_return
end
-
end
describe "within two blocks" do
Added: MacRuby/trunk/spec/frozen/library/date/neww_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/date/neww_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/library/date/neww_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -0,0 +1,13 @@
+require 'date'
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/shared/commercial'
+
+ruby_version_is "" ... "1.9" do
+
+ describe "Date#neww" do
+
+ it_behaves_like(:date_commercial, :neww)
+
+ end
+
+end
Deleted: MacRuby/trunk/spec/frozen/library/delegate/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/delegate/fixtures/classes.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/delegate/fixtures/classes.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,24 +0,0 @@
-module DelegateSpecs
- class Simple
- def pub
- :foo
- end
-
- def respond_to_missing?(method, priv=false)
- method == :pub_too ||
- (priv && method == :priv_too)
- end
-
- def method_missing(method, *args)
- super unless respond_to_missing?(method, true)
- method
- end
-
- def priv(arg=nil)
- yield arg if block_given?
- [:priv, arg]
- end
- private :priv
-
- end
-end
Deleted: MacRuby/trunk/spec/frozen/library/delegate/method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/delegate/method_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/delegate/method_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,38 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + "/fixtures/classes"
-require 'delegate'
-
-describe "SimpleDelegator#method" do
- before :each do
- @simple = DelegateSpecs::Simple.new
- @delegate = SimpleDelegator.new(@simple)
- end
-
- it "returns a method object for a valid method" do
- m = @delegate.method(:pub)
- m.should be_an_instance_of(Method)
- m.call.should == :foo
- end
-
- it "raises a NameError for an invalid method name" do
- lambda {
- @delegate.method(:invalid_and_silly_method_name)
- }.should raise_error(NameError)
- end
-
- ruby_version_is "1.9" do
- it "returns a method that respond_to_missing?" do
- m = @delegate.method(:pub_too)
- m.should be_an_instance_of(Method)
- m.call.should == :pub_too
- end
- end
-
- it "raises a NameError if method is no longer valid because object has changed" do
- m = @delegate.method(:pub)
- @delegate.__setobj__([1,2,3])
- lambda {
- m.call
- }.should raise_error(NameError)
- end
-end
Deleted: MacRuby/trunk/spec/frozen/library/delegate/send_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/delegate/send_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/delegate/send_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1,26 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + "/fixtures/classes"
-require 'delegate'
-
-describe "SimpleDelegator.new" do
- before :each do
- @simple = DelegateSpecs::Simple.new
- @delegate = SimpleDelegator.new(@simple)
- end
-
- it "forwards public method calls" do
- @delegate.pub.should == :foo
- end
-
- it "doesn't forward private method calls" do
- lambda{ @delegate.priv }.should raise_error( NoMethodError )
- end
-
- ruby_bug "redmine:2206", "1.8.7" do
- it "forwards private method calls made via send or __send__" do
- @delegate.send(:priv, 42).should == [:priv, 42]
- @delegate.__send__(:priv, 42).should == [:priv, 42]
- lambda{ @delegate.__send__(:priv, 42){@delegate.priv} }.should raise_error( NoMethodError )
- end
- end
-end
Modified: MacRuby/trunk/spec/frozen/library/getoptlong/error_message_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/getoptlong/error_message_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/getoptlong/error_message_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -19,14 +19,14 @@
it "returns the error message of the last error that occurred" do
begin
+ $stderr = IOStub.new
ARGV = []
opts = GetoptLong.new
- opts.quiet = true
opts.get
opts.ordering = GetoptLong::PERMUTE
rescue ArgumentError
opts.error_message.should == "argument error"
end
end
-end
+end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/library/getoptlong/ordering_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/getoptlong/ordering_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/getoptlong/ordering_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -4,12 +4,13 @@
describe "GetoptLong#ordering=" do
it "raises an ArgumentError if called after processing has started" do
begin
+ s = $stderr
+ $stderr = IOStub.new
old_argv = ARGV
ARGV = [ "--size", "10k", "--verbose" ]
opts = GetoptLong.new([ '--size', GetoptLong::REQUIRED_ARGUMENT ],
[ '--verbose', GetoptLong::NO_ARGUMENT ])
- opts.quiet = true
opts.get
lambda {
@@ -17,6 +18,7 @@
}.should raise_error(ArgumentError)
ensure
ARGV = old_argv
+ $stderr = s
end
end
@@ -40,4 +42,4 @@
ENV['POSIXLY_CORRECT'] = old_env_value
end
end
-end
+end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/library/getoptlong/shared/get.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/getoptlong/shared/get.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/getoptlong/shared/get.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -6,7 +6,6 @@
[ '--query', '-q', GetoptLong::NO_ARGUMENT ],
[ '--check', '--valid', '-c', GetoptLong::NO_ARGUMENT ]
)
- @opts.quiet = true # silence using $deferr
end
it "returns the next option name and its argument as an Array" do
@@ -64,12 +63,15 @@
it "raises a if an argument was required, but none given" do
begin
+ s = $stderr
+ $stderr = IOStub.new
old_argv = ARGV
ARGV = [ "--size" ]
lambda { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument)
ensure
ARGV = old_argv
+ $stderr = s
end
end
end
Modified: MacRuby/trunk/spec/frozen/library/mutex/lock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mutex/lock_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/mutex/lock_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -26,10 +26,4 @@
th.join
v.should == 1
end
-
- it "raises ThreadError if the current thread already locks this monitor" do
- mutex = Mutex.new
- mutex.lock
- lambda { mutex.lock }.should raise_error(ThreadError)
- end
end
Modified: MacRuby/trunk/spec/frozen/library/mutex/try_lock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mutex/try_lock_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/mutex/try_lock_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -5,18 +5,8 @@
it "returns true if lock can be aquired immediately" do
m = Mutex.new
m.try_lock.should be_true
- m.try_lock.should be_false
end
- it "actually locks" do
- m = Mutex.new
- m.try_lock
-
- m.locked?.should be_true
- lambda { m.lock }.should raise_error(ThreadError)
- lambda { m.try_lock }.should_not raise_error(ThreadError)
- end
-
it "returns false if lock can not be aquired immediately" do
m1 = Mutex.new
m2 = Mutex.new
Modified: MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/mutex/unlock_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -25,17 +25,6 @@
th.join
end
- it "raises ThreadError if previously locking thread is gone" do
- mutex = Mutex.new
- th = Thread.new do
- mutex.lock
- end
-
- th.join
-
- lambda { mutex.unlock }.should raise_error(ThreadError)
- end
-
it "returns nil if successful" do
mutex = Mutex.new
mutex.lock
Modified: MacRuby/trunk/spec/frozen/library/socket/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/fixtures/classes.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/socket/fixtures/classes.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -22,6 +22,6 @@
end
def self.socket_path
- tmp("unix_server_spec.socket")
+ "/tmp/unix_server_spec.socket"
end
end
Modified: MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/tmpdir/dir/mktmpdir_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -50,7 +50,6 @@
end
it "returns the blocks return value" do
- Dir.stub!(:mkdir)
Dir.mktmpdir { :test }.should equal(:test)
end
end
@@ -91,4 +90,4 @@
lambda { Dir.mktmpdir(10) }.should raise_error(ArgumentError)
end
end
-end
+end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/library/zlib/deflate/params_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/deflate/params_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/zlib/deflate/params_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -2,7 +2,7 @@
require 'zlib'
describe 'Zlib::Deflate#params' do
- ruby_bug '239', '1.9.0' do
+ ruby_bug '293', '1.9.0' do
it 'changes the deflate parameters' do
data = 'abcdefghijklm'
Modified: MacRuby/trunk/spec/frozen/library/zlib/inflate/append_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/inflate/append_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/zlib/inflate/append_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -2,59 +2,11 @@
require 'zlib'
describe 'Zlib::Inflate#<<' do
- before :all do
- @foo_deflated = "x\234K\313\317\a\000\002\202\001E"
- end
-
- before :each do
- @z = Zlib::Inflate.new
- end
-
- after :each do
- @z.close unless @z.closed?
- end
-
it 'appends data to the input stream' do
- @z << @foo_deflated
- @z.finish.should == 'foo'
- end
+ zs = Zlib::Inflate.new
+ zs << "x\234K\313\317\a\000\002\202\001E"
- it 'treats nil argument as the end of compressed data' do
- @z = Zlib::Inflate.new
- @z << @foo_deflated << nil
- @z.finish.should == 'foo'
+ zs.finish.should == 'foo'
end
-
- it 'just passes through the data after nil argument' do
- @z = Zlib::Inflate.new
- @z << @foo_deflated << nil
- @z << "-after_nil_data"
- @z.finish.should == 'foo-after_nil_data'
- end
-
- it 'properly handles data in chunks' do
- # add bytes, one by one
- @foo_deflated.each_byte { |d| @z << d.chr}
- @z.finish.should == "foo"
- end
-
- it 'properly handles incomplete data' do
- # add bytes, one by one
- @foo_deflated[0, 5].each_byte { |d| @z << d.chr}
- lambda { @z.finish }.should raise_error(Zlib::BufError)
- end
-
- it 'properly handles excessive data, byte-by-byte' do
- # add bytes, one by one
- data = @foo_deflated * 2
- data.each_byte { |d| @z << d.chr}
- @z.finish.should == "foo" + @foo_deflated
- end
-
- it 'properly handles excessive data, in one go' do
- # add bytes, one by one
- data = @foo_deflated * 2
- @z << data
- @z.finish.should == "foo" + @foo_deflated
- end
end
+
Modified: MacRuby/trunk/spec/frozen/library/zlib/inflate/inflate_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/zlib/inflate/inflate_spec.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/library/zlib/inflate/inflate_spec.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -25,20 +25,6 @@
unzipped.should == "\000" * 32 * 1024
end
- it 'works in pass-through mode, once finished' do
- data = "x\234c`\200\001\000\000\n\000\001"
-
- unzipped = @inflator.inflate data
- @inflator.finish # this is a precondition
-
- out = @inflator.inflate('uncompressed_data')
- out << @inflator.finish
- out.should == 'uncompressed_data'
-
- @inflator << ('uncompressed_data') << nil
- @inflator.finish.should == 'uncompressed_data'
- end
-
end
describe 'Zlib::Inflate::inflate' do
@@ -59,51 +45,5 @@
zipped.should == "\000" * 32 * 1024
end
- it 'properly handles data in chunks' do
- data = "x\234K\313\317\a\000\002\202\001E"
- z = Zlib::Inflate.new
- # add bytes, one by one
- result = ""
- data.each_byte { |d| result << z.inflate(d.chr)}
- result << z.finish
- result.should == "foo"
- end
-
- it 'properly handles incomplete data' do
- data = "x\234K\313\317\a\000\002\202\001E"[0,5]
- z = Zlib::Inflate.new
- # add bytes, one by one, but not all
- result = ""
- data.each_byte { |d| result << z.inflate(d.chr)}
- lambda { result << z.finish }.should raise_error(Zlib::BufError)
- end
-
- it 'properly handles excessive data, byte-by-byte' do
- main_data = "x\234K\313\317\a\000\002\202\001E"
- data = main_data * 2
- result = ""
-
- z = Zlib::Inflate.new
- # add bytes, one by one
- data.each_byte { |d| result << z.inflate(d.chr)}
- result << z.finish
-
- # the first chunk is inflated to its completion,
- # the second chunk is just passed through.
- result.should == "foo" + main_data
- end
-
- it 'properly handles excessive data, in one go' do
- main_data = "x\234K\313\317\a\000\002\202\001E"
- data = main_data * 2
- result = ""
-
- z = Zlib::Inflate.new
- result << z.inflate(data)
- result << z.finish
-
- # the first chunk is inflated to its completion,
- # the second chunk is just passed through.
- result.should == "foo" + main_data
- end
end
+
Modified: MacRuby/trunk/spec/frozen/shared/rational/div.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/rational/div.rb 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/shared/rational/div.rb 2009-10-15 20:10:20 UTC (rev 2812)
@@ -2,38 +2,38 @@
require 'rational'
describe :rational_div_rat, :shared => true do
- it "performs integer division and returns the result" do
+ it "performs integer division and returns the result" do
Rational(2, 3).div(Rational(2, 3)).should == 1
Rational(-2, 9).div(Rational(-9, 2)).should == 0
end
-
+
it "raises a ZeroDivisionError when the argument has a numerator of 0" do
lambda { Rational(3, 4).div(Rational(0, 3)) }.should raise_error(ZeroDivisionError)
- end
-
+ end
+
# 1.8 doesn't accept Floats for Rational() arguments
ruby_version_is "1.9" do
it "raises a ZeroDivisionError when the argument has a numerator of 0.0" do
lambda { Rational(3, 4).div(Rational(0.0, 3)) }.should raise_error(ZeroDivisionError)
end
end
-end
+end
describe :rational_div_float, :shared => true do
# The version guard is necessary because 1.8 can't cope with Floats passed
# to Rational(), so we need to simplify the examples accordingly.
-
+
ruby_version_is "1.9" do
- it "performs integer division and returns the result" do
+ it "performs integer division and returns the result" do
Rational(2, 3).div(30.333).should == 0
Rational(2, 9).div(Rational(-8.6)).should == -1
Rational(3.12).div(0.5).should == 6
end
end
-
+
ruby_version_is ""..."1.9" do
- it "performs integer division and returns the result" do
+ it "performs integer division and returns the result" do
Rational(2, 3).div(30.333).should == 0
Rational(7, 12).div(0.5).should == 1
end
@@ -42,40 +42,39 @@
ruby_version_is ""..."1.9" do
it "raises a FloatDomainError when the argument is 0.0" do
lambda { Rational(3, 4).div(0.0) }.should raise_error(FloatDomainError)
- end
+ end
end
ruby_version_is "1.9" do
it "raises a ZeroDivisionError when the argument is 0.0" do
lambda { Rational(3, 4).div(0.0) }.should raise_error(ZeroDivisionError)
- end
+ end
end
-end
+end
describe :rational_div_int, :shared => true do
- it "performs integer division and returns the result" do
+ it "performs integer division and returns the result" do
Rational(2, 1).div(1).should == 2
Rational(25, 5).div(-50).should == -1
end
-
+
it "raises a ZeroDivisionError when the argument is 0" do
lambda { Rational(3, 4).div(0) }.should raise_error(ZeroDivisionError)
- end
-end
+ end
+end
describe :rational_div, :shared => true do
- it "returns an Integer" do
+ it "returns an Integer" do
Rational(229, 21).div(82).should be_kind_of(Integer)
end
-
+
it "raises an ArgumentError if passed more than one argument" do
lambda { Rational(3, 4).div(2,3) }.should raise_error(ArgumentError)
- end
+ end
- # See http://redmine.ruby-lang.org/issues/show/1648
- ruby_version_is "1.8.8" do
+ ruby_bug "#1648", "1.8.7" do
it "raises a TypeError if passed a non-numeric argument" do
lambda { Rational(3, 4).div([]) }.should raise_error(TypeError)
end
- end
-end
+ end
+end
Modified: MacRuby/trunk/spec/frozen/tags/1.9/core/argf/bytes_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/1.9/core/argf/bytes_tags.txt 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/tags/1.9/core/argf/bytes_tags.txt 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1 +1,2 @@
fails:ARGF.bytes returns self when passed a block
+fails:ARGF.bytes returns an Enumerable::Enumerator when passed no block
Modified: MacRuby/trunk/spec/frozen/tags/1.9/core/argf/chars_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/1.9/core/argf/chars_tags.txt 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/tags/1.9/core/argf/chars_tags.txt 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1 +1,2 @@
fails:ARGF.chars returns self when passed a block
+fails:ARGF.chars returns an Enumerable::Enumerator when passed no block
Modified: MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_byte_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_byte_tags.txt 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_byte_tags.txt 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1 +1,2 @@
fails:ARGF.each_byte returns self when passed a block
+fails:ARGF.each_byte returns an Enumerable::Enumerator when passed no block
Modified: MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_char_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_char_tags.txt 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/tags/1.9/core/argf/each_char_tags.txt 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1 +1,2 @@
fails:ARGF.each_char returns self when passed a block
+fails:ARGF.each_char returns an Enumerable::Enumerator when passed no block
Added: MacRuby/trunk/spec/frozen/tags/1.9/core/argf/lineno_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/1.9/core/argf/lineno_tags.txt (rev 0)
+++ MacRuby/trunk/spec/frozen/tags/1.9/core/argf/lineno_tags.txt 2009-10-15 20:10:20 UTC (rev 2812)
@@ -0,0 +1 @@
+fails:ARGF.lineno returns the current line number on each file
Modified: MacRuby/trunk/spec/frozen/upstream
===================================================================
--- MacRuby/trunk/spec/frozen/upstream 2009-10-15 18:49:22 UTC (rev 2811)
+++ MacRuby/trunk/spec/frozen/upstream 2009-10-15 20:10:20 UTC (rev 2812)
@@ -1 +1 @@
-2d102bae115e11719ff355d99ef336c0889b769a
\ No newline at end of file
+1dffcb6782dfa03652348a3143569abba086d290
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091015/d72043a1/attachment-0001.html>
More information about the macruby-changes
mailing list