[macruby-changes] [2713] MacRuby/trunk/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Sun Oct 4 14:45:48 PDT 2009
Revision: 2713
http://trac.macosforge.org/projects/ruby/changeset/2713
Author: eloy.de.enige at gmail.com
Date: 2009-10-04 14:45:47 -0700 (Sun, 04 Oct 2009)
Log Message:
-----------
Updated RubySpec to 1dffcb6782dfa03652348a3143569abba086d290
Modified Paths:
--------------
MacRuby/trunk/spec/frozen/core/array/combination_spec.rb
MacRuby/trunk/spec/frozen/core/array/hash_spec.rb
MacRuby/trunk/spec/frozen/core/array/pack_spec.rb
MacRuby/trunk/spec/frozen/core/class/superclass_spec.rb
MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb
MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb
MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb
MacRuby/trunk/spec/frozen/core/file/rename_spec.rb
MacRuby/trunk/spec/frozen/core/file/size_spec.rb
MacRuby/trunk/spec/frozen/core/file/stat/size_spec.rb
MacRuby/trunk/spec/frozen/core/filetest/size_spec.rb
MacRuby/trunk/spec/frozen/core/hash/hash_spec.rb
MacRuby/trunk/spec/frozen/core/io/binmode_spec.rb
MacRuby/trunk/spec/frozen/core/io/foreach_spec.rb
MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
MacRuby/trunk/spec/frozen/core/io/readline_spec.rb
MacRuby/trunk/spec/frozen/core/io/shared/new.rb
MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/define_singleton_method_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/equal_spec.rb
MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb
MacRuby/trunk/spec/frozen/core/method/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/method/name_spec.rb
MacRuby/trunk/spec/frozen/core/method/shared/eql.rb
MacRuby/trunk/spec/frozen/core/module/attr_spec.rb
MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb
MacRuby/trunk/spec/frozen/core/proc/new_spec.rb
MacRuby/trunk/spec/frozen/core/string/encode_spec.rb
MacRuby/trunk/spec/frozen/core/string/equal_value_spec_disabled.rb
MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb
MacRuby/trunk/spec/frozen/core/struct/inspect_spec.rb
MacRuby/trunk/spec/frozen/core/struct/to_s_spec.rb
MacRuby/trunk/spec/frozen/core/thread/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/thread/join_spec.rb
MacRuby/trunk/spec/frozen/core/thread/key_spec.rb
MacRuby/trunk/spec/frozen/core/thread/shared/exit.rb
MacRuby/trunk/spec/frozen/core/thread/value_spec.rb
MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb
MacRuby/trunk/spec/frozen/core/time/strftime_spec.rb
MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec.rb
MacRuby/trunk/spec/frozen/core/unboundmethod/fixtures/classes.rb
MacRuby/trunk/spec/frozen/core/unboundmethod/name_spec.rb
MacRuby/trunk/spec/frozen/language/defined_spec.rb
MacRuby/trunk/spec/frozen/language/ensure_spec.rb
MacRuby/trunk/spec/frozen/language/file_spec.rb
MacRuby/trunk/spec/frozen/language/for_spec.rb
MacRuby/trunk/spec/frozen/language/hash_spec.rb
MacRuby/trunk/spec/frozen/language/private_spec.rb
MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb
MacRuby/trunk/spec/frozen/language/regexp/versions/character_classes_1.9.rb
MacRuby/trunk/spec/frozen/language/return_spec.rb
MacRuby/trunk/spec/frozen/language/undef_spec.rb
MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb
MacRuby/trunk/spec/frozen/library/cgi/cookie/value_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/coerce_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/divide_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/minus_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/multiply_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/plus_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/rank_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/row_spec.rb
MacRuby/trunk/spec/frozen/library/matrix/shared/determinant.rb
MacRuby/trunk/spec/frozen/library/net/http/httpgenericrequest/exec_spec.rb
MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_read_spec.rb
MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_write_spec.rb
MacRuby/trunk/spec/frozen/library/socket/ipsocket/getaddress_spec.rb
MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb
MacRuby/trunk/spec/frozen/library/socket/socket/getnameinfo_spec.rb
MacRuby/trunk/spec/frozen/library/tempfile/open_spec.rb
MacRuby/trunk/spec/frozen/optional/ffi/pointer_spec.rb
MacRuby/trunk/spec/frozen/shared/file/size.rb
MacRuby/trunk/spec/frozen/upstream
Added Paths:
-----------
MacRuby/trunk/spec/frozen/core/enumerable/chunk_spec.rb
MacRuby/trunk/spec/frozen/core/enumerator/each_with_object_spec.rb
MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb
MacRuby/trunk/spec/frozen/core/io/versions/
MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb
MacRuby/trunk/spec/frozen/core/kernel/respond_to_missing_spec.rb
MacRuby/trunk/spec/frozen/core/matchdata/eql_spec.rb
MacRuby/trunk/spec/frozen/core/matchdata/equal_value_spec.rb
MacRuby/trunk/spec/frozen/core/matchdata/names_spec.rb
MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb
MacRuby/trunk/spec/frozen/core/matchdata/shared/eql.rb
MacRuby/trunk/spec/frozen/core/matchdata/versions/names_1.9.rb
MacRuby/trunk/spec/frozen/core/struct/shared/inspect.rb
MacRuby/trunk/spec/frozen/library/mathn/bignum/
MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb
MacRuby/trunk/spec/frozen/library/mathn/fixnum/
MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb
MacRuby/trunk/spec/frozen/library/mathn/float/
MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb
MacRuby/trunk/spec/frozen/library/openssl/config/
MacRuby/trunk/spec/frozen/library/openssl/config/freeze_spec.rb
MacRuby/trunk/spec/frozen/shared/enumerator/with_object.rb
Removed Paths:
-------------
MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/rank_tags.txt.orig
MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/regular_tags.txt.orig
Modified: MacRuby/trunk/spec/frozen/core/array/combination_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/combination_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/array/combination_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -22,9 +22,9 @@
a.combination(3).to_a.sort.should == [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
end
- if "yields [] when length is 0"
+ it "yields [] when length is 0" do
[1,2,3].combination(0).to_a.should == [[]] # one combination of length 0
[].combination(0).to_a.should == [[]] # one combination of length 0
end
end
-end
\ No newline at end of file
+end
Modified: MacRuby/trunk/spec/frozen/core/array/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/hash_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/array/hash_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -21,6 +21,20 @@
end
end
+ ruby_bug "redmine #1852", "1.9.1" do
+ it "returns the same hash for recursive arrays" do
+ rec = []; rec << rec
+ rec.hash.should == [rec].hash
+ rec.hash.should == [[rec]].hash
+ end
+
+ it "returns the same hash for recursive arrays through hashes" do
+ h = {} ; rec = [h] ; h[:x] = rec
+ rec.hash.should == [h].hash
+ rec.hash.should == [{:x => rec}].hash
+ end
+ end
+
# Too much of an implementation detail? -rue
not_compliant_on :rubinius do
it "calls to_int on result of calling hash on each element" do
Modified: MacRuby/trunk/spec/frozen/core/array/pack_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/array/pack_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/array/pack_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -847,7 +847,7 @@
it "does not raise a RangeError even when a pack argument is >= 2**64" do
[2**64-1].pack(format).should == binary("\xFF\xFF")
[2**64 ].pack(format).should == binary("\x00\x00")
- [2**64+1].pack(format).should == binary("\x00\x01")
+ [2**64+1].pack(format).should == binary("\x01\x00")
end
it "does not raise a RangeError even when a pack argument is <= -2**64" do
Modified: MacRuby/trunk/spec/frozen/core/class/superclass_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/class/superclass_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/class/superclass_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
describe "Class#superclass" do
ruby_version_is ""..."1.9" do
@@ -21,4 +22,19 @@
Class.new(Fixnum).superclass.should == Fixnum
end
end
+
+ ruby_bug "redmine:567", "1.8.7" do
+ describe "for a singleton class" do
+ it "of an object returns the class of the object" do
+ a = CoreClassSpecs::A.new
+ sc = class << a; self; end
+ sc.superclass.should == CoreClassSpecs::A
+ end
+
+ it "of a class returns the singleton class of its superclass" do # sorry, can't find a simpler way to express this...
+ sc = class << CoreClassSpecs::H; self; end
+ sc.superclass.should == class << CoreClassSpecs::A; self; end
+ end
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/dir/chdir_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -5,11 +5,11 @@
before(:each) do
@original = Dir.pwd
end
-
+
after(:each) do
Dir.chdir(@original)
end
-
+
it "defaults to $HOME with no arguments" do
if ENV['HOME']
Dir.chdir(ENV['HOME'])
@@ -19,16 +19,16 @@
DirSpecs.pwd.should == home
end
end
-
+
it "changes to the specified directory" do
Dir.chdir DirSpecs.mock_dir
DirSpecs.pwd.should == DirSpecs.mock_dir
end
-
+
it "returns 0 when successfully changing directory" do
Dir.chdir(@original).should == 0
end
-
+
it "calls #to_str on the argument if it's not a String" do
obj = mock('path')
obj.should_receive(:to_str).and_return(Dir.pwd)
@@ -55,9 +55,15 @@
it "returns the value of the block when a block is given" do
Dir.chdir(@original) { :block_value }.should == :block_value
end
-
+
it "defaults to the home directory when given a block but no argument" do
- Dir.chdir { Dir.pwd.should == ENV['HOME'] }
+ # Windows will return a path with forward slashes for ENV["HOME"] so we have
+ # to compare the route representations returned by Dir.chdir.
+ current_dir = ""
+ Dir.chdir { current_dir = Dir.pwd }
+
+ Dir.chdir(ENV['HOME'])
+ current_dir.should == Dir.pwd
end
it "changes to the specified directory for the duration of the block" do
@@ -66,7 +72,7 @@
DirSpecs.pwd.should == @original
end
-
+
it "raises a SystemCallError if the directory does not exist" do
lambda { Dir.chdir DirSpecs.nonexistent }.should raise_error(SystemCallError)
lambda { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(SystemCallError)
Modified: MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/dir/mkdir_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -44,22 +44,26 @@
end
end
- it "raises a SystemCallError when lacking adequate permissions in the parent dir" do
- # In case something happened it it didn't get cleaned up.
- FileUtils.rm_rf 'noperms' if File.directory? 'noperms'
+ # The permissions flag are not supported on Windows as stated in documentation:
+ # The permissions may be modified by the value of File::umask, and are ignored on NT.
+ platform_is_not :windows do
+ it "raises a SystemCallError when lacking adequate permissions in the parent dir" do
+ # In case something happened it it didn't get cleaned up.
+ FileUtils.rm_rf 'noperms' if File.directory? 'noperms'
- Dir.mkdir 'noperms', 0000
+ Dir.mkdir 'noperms', 0000
- lambda { Dir.mkdir 'noperms/subdir' }.should raise_error(SystemCallError)
+ lambda { Dir.mkdir 'noperms/subdir' }.should raise_error(SystemCallError)
- system 'chmod 0777 noperms'
- platform_is_not :windows do
- File.chmod 0777, "noperms"
+ system 'chmod 0777 noperms'
+ platform_is_not :windows do
+ File.chmod 0777, "noperms"
+ end
+ platform_is :windows do
+ File.chmod 0666, "noperms"
+ end
+ Dir.rmdir 'noperms'
end
- platform_is :windows do
- File.chmod 0666, "noperms"
- end
- Dir.rmdir 'noperms'
end
it "raises a SystemCallError if any of the directories in the path before the last does not exist" do
Added: MacRuby/trunk/spec/frozen/core/enumerable/chunk_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerable/chunk_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/enumerable/chunk_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,44 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
+
+ruby_version_is "1.9" do
+ describe "Enumerable#chunk" do
+ it "raises an ArgumentError if called without a block" do
+ lambda do
+ EnumerableSpecs::Numerous.new.chunk
+ end.should raise_error(ArgumentError)
+ end
+
+ it "returns an Enumerator if given a block" do
+ EnumerableSpecs::Numerous.new.chunk {}.should be_an_instance_of(Enumerator)
+ end
+
+ it "yields each element of the Enumerable to the block" do
+ yields = []
+ EnumerableSpecs::Numerous.new.chunk {|e| yields << e}.to_a
+ EnumerableSpecs::Numerous.new.to_a.should == yields
+ end
+
+ it "returns an Enumerator of 2-element Arrays" do
+ EnumerableSpecs::Numerous.new.chunk {|e| true}.each do |a|
+ a.should be_an_instance_of(Array)
+ a.size.should == 2
+ end
+ end
+
+ it "sets the first element of each sub-Array to the return value of the block" do
+ EnumerableSpecs::Numerous.new.chunk {|e| -e }.each do |a|
+ a.first.should == -a.last.first
+ end
+ end
+
+ it "sets the last element of each sub-Array to the consecutive values for which the block returned the first element" do
+ ret = EnumerableSpecs::Numerous.new(5,5,2,3,4,5,7,1,9).chunk {|e| e >= 5 }.to_a
+ ret[0].last.should == [5, 5]
+ ret[1].last.should == [2, 3, 4]
+ ret[2].last.should == [5, 7]
+ ret[3].last.should == [1]
+ ret[4].last.should == [9]
+ end
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/enumerator/each_with_object_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerator/each_with_object_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/enumerator/each_with_object_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/../../shared/enumerator/with_object'
+
+ruby_version_is "1.9" do
+ describe "Enumerator#each_with_object" do
+ it_behaves_like :enum_with_object, :each_with_object
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/enumerator/with_object_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/../../shared/enumerator/with_object'
+
+ruby_version_is "1.9" do
+ describe "Enumerator#with_object" do
+ it_behaves_like :enum_with_object, :with_object
+ end
+end
Modified: MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/file/mtime_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -27,6 +27,7 @@
end
after :each do
+ @f.close
File.delete(@filename) if File.exist?(@filename)
end
Modified: MacRuby/trunk/spec/frozen/core/file/rename_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/rename_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/file/rename_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -14,27 +14,25 @@
File.delete(@new) if File.exist?(@new)
end
- platform_is_not :windows do
- it "renames a file " do
- File.exists?(@old).should == true
- File.exists?(@new).should == false
- File.rename(@old, @new)
- File.exists?(@old).should == false
- File.exists?(@new).should == true
- end
+ it "renames a file " do
+ File.exists?(@old).should == true
+ File.exists?(@new).should == false
+ File.rename(@old, @new)
+ File.exists?(@old).should == false
+ File.exists?(@new).should == true
+ end
- it "raises an Errno::ENOENT if the source does not exist" do
- File.delete(@old)
- lambda { File.rename(@old, @new) }.should raise_error(Errno::ENOENT)
- end
+ it "raises an Errno::ENOENT if the source does not exist" do
+ File.delete(@old)
+ lambda { File.rename(@old, @new) }.should raise_error(Errno::ENOENT)
+ end
- it "raises an ArgumentError if not passed two arguments" do
- lambda { File.rename }.should raise_error(ArgumentError)
- lambda { File.rename(@file) }.should raise_error(ArgumentError)
- end
+ it "raises an ArgumentError if not passed two arguments" do
+ lambda { File.rename }.should raise_error(ArgumentError)
+ lambda { File.rename(@file) }.should raise_error(ArgumentError)
+ end
- it "raises a TypeError if not passed String types" do
- lambda { File.rename(1, 2) }.should raise_error(TypeError)
- end
+ it "raises a TypeError if not passed String types" do
+ lambda { File.rename(1, 2) }.should raise_error(TypeError)
end
end
Modified: MacRuby/trunk/spec/frozen/core/file/size_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/size_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/file/size_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,41 +1,18 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/../../shared/file/size'
-describe "File.size" do
- before :each do
- @file = tmp('i_exist')
- File.open(@file,'w'){|f| f.write 'rubinius'}
- end
-
- after :each do
- File.delete(@file) if File.exist?(@file)
- end
-
- it "returns the size of the file" do
- File.size(@file).should == 8
- end
-
- it "accepts a String-like (to_str) parameter" do
- o = [@file]
- def o.to_str; self[0]; end
-
- File.size(o).should == 8
- end
-
- it "accepts a File argument" do
- File.size(File.open(@file)).should == 8
- end
-
- ruby_version_is "1.9" do
- it "accepts an object that has a #to_path method" do
- File.size(mock_to_path(@file)).should == 8
- end
- end
+describe "File.size?" do
+ it_behaves_like :file_size, :size?, File
+ it_behaves_like :file_size_nil_when_missing, :size?, File
+ it_behaves_like :file_size_nil_when_empty, :size?, File
+ it_behaves_like :file_size_with_file_argument, :size?, File
end
-describe "File.size?" do
- it_behaves_like :file_size, :size?, File
- it_behaves_like :file_size_missing, :size?, File
+describe "File.size" do
+ it_behaves_like :file_size, :size, File
+ it_behaves_like :file_size_raise_when_missing, :size, File
+ it_behaves_like :file_size_0_when_empty, :size, File
+ it_behaves_like :file_size_with_file_argument, :size, File
end
ruby_version_is "1.9" do
Modified: MacRuby/trunk/spec/frozen/core/file/stat/size_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/file/stat/size_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/file/stat/size_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,6 +2,12 @@
require File.dirname(__FILE__) + '/../../../shared/file/size'
require File.dirname(__FILE__) + '/fixtures/classes'
-describe "File::Stat#size?" do
- it_behaves_like :file_size, :size?, FileStat
+describe "File::Stat.size?" do
+ it_behaves_like :file_size, :size?, FileStat
+ it_behaves_like :file_size_nil_when_empty, :size?, FileStat
end
+
+describe "File::Stat.size" do
+ it_behaves_like :file_size, :size, FileStat
+ it_behaves_like :file_size_0_when_empty, :size, FileStat
+end
Modified: MacRuby/trunk/spec/frozen/core/filetest/size_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/filetest/size_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/filetest/size_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,6 +2,15 @@
require File.dirname(__FILE__) + '/../../shared/file/size'
describe "FileTest.size?" do
- it_behaves_like :file_size, :size?, FileTest
- it_behaves_like :file_size_missing, :size?, FileTest
+ it_behaves_like :file_size, :size?, FileTest
+ it_behaves_like :file_size_nil_when_missing, :size?, FileTest
+ it_behaves_like :file_size_nil_when_empty, :size?, FileTest
+ it_behaves_like :file_size_with_file_argument, :size?, FileTest
end
+
+describe "FileTest.size" do
+ it_behaves_like :file_size, :size, FileTest
+ it_behaves_like :file_size_raise_when_missing, :size, FileTest
+ it_behaves_like :file_size_0_when_empty, :size, FileTest
+ it_behaves_like :file_size_with_file_argument, :size, FileTest
+end
Modified: MacRuby/trunk/spec/frozen/core/hash/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/hash_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/hash/hash_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -22,6 +22,20 @@
(h.hash == h[:a].hash).should == true
end
+ ruby_bug "redmine #1852", "1.9.1" do
+ it "returns the same hash for recursive hashes" do
+ h = {} ; h[:x] = h
+ h.hash.should == {:x => h}.hash
+ h.hash.should == {:x => {:x => h}}.hash
+ end
+
+ it "returns the same hash for recursive hashes through arrays" do
+ h = {} ; rec = [h] ; h[:x] = rec
+ h.hash.should == {:x => rec}.hash
+ h.hash.should == {:x => [h]}.hash
+ end
+ end
+
ruby_version_is "" .. "1.8.6" do
it "computes recursive hash keys with identical hashes" do
h = new_hash
Modified: MacRuby/trunk/spec/frozen/core/io/binmode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/binmode_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/io/binmode_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -12,10 +12,20 @@
File.unlink @filename
end
- it "does not raise any errors on closed stream" do
- lambda { IOSpecs.closed_file.binmode }.should_not raise_error()
+ ruby_version_is ""..."1.9" do
+ ruby_bug "#2046", "1.8.7.174" do
+ it "raises an IOError on closed stream" do
+ lambda { IOSpecs.closed_file.binmode }.should raise_error(IOError)
+ end
+ end
end
+ ruby_version_is "1.9" do
+ it "raises an IOError on closed stream" do
+ lambda { IOSpecs.closed_file.binmode }.should raise_error(IOError)
+ end
+ end
+
# Even if it does nothing in Unix it should not raise any errors.
it "puts a stream in binary mode" do
lambda { @file.binmode }.should_not raise_error
Modified: MacRuby/trunk/spec/frozen/core/io/foreach_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/foreach_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/io/foreach_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -92,6 +92,12 @@
}.should raise_error(TypeError)
end
+ it "raises Errno::ENOENT on invalid_file_name" do
+ lambda {
+ IO::foreach("_1_2_3_4_nonexistent_hmm") {}
+ }.should raise_error(Errno::ENOENT)
+ end
+
it "converts first parameter to string and uses as file name" do
(obj = mock('readlines.txt')).should_receive(:to_str).and_return(@file)
lines = []
Modified: MacRuby/trunk/spec/frozen/core/io/gets_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/gets_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/io/gets_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -189,4 +189,30 @@
b.should == "\nB\n"
File.unlink(tmp("gets_specs"))
end
+
+ ruby_version_is "1.9" do
+ it "accepts an integer as first parameter to limit the output's size" do
+ f = File.open(tmp("gets_specs"), "w")
+ f.print("waduswadus")
+ f.close
+
+ f = File.new(tmp("gets_specs"), "r")
+ b = f.gets(5)
+ b.should == 'wadus'
+
+ File.unlink(tmp("gets_specs"))
+ end
+
+ it "accepts an integer as second parameter to limit the output's size" do
+ f = File.open(tmp("gets_specs"), "w")
+ f.print("wa\n\ndus\n\nwadus")
+ f.close
+
+ f = File.new(tmp("gets_specs"), "r")
+ b = f.gets('\n\n', 5)
+ b.should == "wa\n\nd"
+
+ File.unlink(tmp("gets_specs"))
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/io/readline_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/readline_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/io/readline_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -40,4 +40,13 @@
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_file.readline }.should raise_error(IOError)
end
+
+ it "assigns the returned line to $_" do
+ File.open(IOSpecs.gets_fixtures, 'r') do |f|
+ IOSpecs.lines.each do |line|
+ f.readline
+ $_.should == line
+ end
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/io/shared/new.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/shared/new.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/io/shared/new.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -60,6 +60,10 @@
lambda { IO.send(@method, Object.new, 'r') }.should raise_error(TypeError)
end
+ it "raises ArgumentError if not given any arguments" do
+ lambda { IO.send(@method, IO.new) }.should raise_error(ArgumentError)
+ end
+
it "raises EBADF if the file descriptor given is not a valid and open one" do
lambda { IO.send(@method, -2, 'r') }.should raise_error(Errno::EBADF)
Added: MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/io/versions/gets_1.9.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,34 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe "IO#gets" do
+ after :each do
+ File.delete IOSpecs.gets_output if File.exists?(IOSpecs.gets_output)
+ end
+
+ it "returns <limit bytes if IO size is smaller than limit" do
+ tmp = tmp "gets_specs"
+ f = File.open(tmp, "w") { |f| f.print("A\n") }
+ File.open(tmp) do |f|
+ f.gets("", 10).should == "A\n"
+ end
+ File.unlink tmp
+ end
+
+ it "returns =limit bytes if IO size is same size as limit" do
+ tmp = tmp "gets_specs"
+ f = File.open(tmp, "w") { |f| f.print("ABC\n") }
+ File.open(tmp) do |f|
+ f.gets("", 4).should == "ABC\n"
+ end
+ File.unlink tmp
+ end
+
+ it "returns limit bytes if IO size is greater size than limit" do
+ tmp = tmp "gets_specs"
+ f = File.open(tmp, "w") { |f| f.print("ABCD\n") }
+ File.open(tmp) do |f|
+ f.gets("", 2).should == "AB"
+ end
+ File.unlink tmp
+ end
+end
Modified: MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/kernel/Integer_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -270,9 +270,238 @@
end
end
+describe "Integer() given a String and base", :shared => true do
+ it "raises an ArgumentError if the String is a null byte" do
+ lambda { Integer("\0", 2) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if the String starts with a null byte" do
+ lambda { Integer("\01", 3) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if the String ends with a null byte" do
+ lambda { Integer("1\0", 4) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if the String contains a null byte" do
+ lambda { Integer("1\01", 5) }.should raise_error(ArgumentError)
+ end
+
+ it "ignores leading whitespace" do
+ Integer(" 16", 16).should == 22
+ Integer(" 16", 16).should == 22
+ end
+
+ it "ignores trailing whitespace" do
+ Integer("16 ", 16).should == 22
+ Integer("16 ", 16).should == 22
+ end
+
+ it "raises an ArgumentError if there are leading _s" do
+ lambda { Integer("_1", 7) }.should raise_error(ArgumentError)
+ lambda { Integer("___1", 7) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if there are trailing _s" do
+ lambda { Integer("1_", 12) }.should raise_error(ArgumentError)
+ lambda { Integer("1___", 12) }.should raise_error(ArgumentError)
+ end
+
+ it "ignores an embedded _" do
+ Integer("1_1", 4).should == 5
+ end
+
+ it "raises an ArgumentError if there are multiple embedded _s" do
+ lambda { Integer("1__1", 4) }.should raise_error(ArgumentError)
+ lambda { Integer("1___1", 4) }.should raise_error(ArgumentError)
+ end
+
+ it "ignores a single leading +" do
+ Integer("+10", 3).should == 3
+ end
+
+ it "raises an ArgumentError if there is a space between the + and number" do
+ lambda { Integer("+ 1", 3) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if there are multiple leading +s" do
+ lambda { Integer("++1", 3) }.should raise_error(ArgumentError)
+ lambda { Integer("+++1", 3) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if there are trailing +s" do
+ lambda { Integer("1+", 3) }.should raise_error(ArgumentError)
+ lambda { Integer("1+++", 12) }.should raise_error(ArgumentError)
+ end
+
+ it "makes the number negative if there's a leading -" do
+ Integer("-19", 20).should == -29
+ end
+
+ it "raises an ArgumentError if there are multiple leading -s" do
+ lambda { Integer("--1", 9) }.should raise_error(ArgumentError)
+ lambda { Integer("---1", 9) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if there are trailing -s" do
+ lambda { Integer("1-", 12) }.should raise_error(ArgumentError)
+ lambda { Integer("1---", 12) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError if there is a period" do
+ lambda { Integer("0.0", 3) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError for an empty String" do
+ lambda { Integer("", 12) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError for a base of 1" do
+ lambda { Integer("1", 1) }.should raise_error(ArgumentError)
+ end
+
+ it "raises an ArgumentError for a base of 37" do
+ lambda { Integer("1", 37) }.should raise_error(ArgumentError)
+ end
+
+ it "accepts wholly lowercase alphabetic strings for bases > 10" do
+ Integer('ab',12).should == 131
+ Integer('af',20).should == 215
+ Integer('ghj',30).should == 14929
+ end
+
+ it "accepts wholly uppercase alphabetic strings for bases > 10" do
+ Integer('AB',12).should == 131
+ Integer('AF',20).should == 215
+ Integer('GHJ',30).should == 14929
+ end
+
+ it "accepts mixed-case alphabetic strings for bases > 10" do
+ Integer('Ab',12).should == 131
+ Integer('aF',20).should == 215
+ Integer('GhJ',30).should == 14929
+ end
+
+ it "accepts alphanumeric strings for bases > 10" do
+ Integer('a3e',19).should == 3681
+ Integer('12q',31).should == 1049
+ Integer('c00o',29).should == 292692
+ end
+
+ it "raises an ArgumentError for letters invalid in the given base" do
+ lambda { Integer('z',19) }.should raise_error(ArgumentError)
+ lambda { Integer('c00o',2) }.should raise_error(ArgumentError)
+ end
+
+ %w(x X).each do |x|
+ it "parses the value as a hex number if there's a leading 0#{x} and a base of 16" do
+ Integer("0#{x}10", 16).should == 16
+ Integer("0#{x}dd", 16).should == 221
+ end
+
+ it "is a positive hex number if there's a leading +0#{x} and base of 16" do
+ Integer("+0#{x}1", 16).should == 0x1
+ Integer("+0#{x}dd", 16).should == 0xdd
+ end
+
+ it "is a negative hex number if there's a leading -0#{x} and a base of 16" do
+ Integer("-0#{x}1", 16).should == -0x1
+ Integer("-0#{x}dd", 16).should == -0xdd
+ end
+
+ 2.upto(15) do |base|
+ it "raises an ArgumentError if the number begins with 0#{x} and the base is #{base}" do
+ lambda { Integer("0#{x}1", base) }.should raise_error(ArgumentError)
+ end
+ end
+
+ it "raises an ArgumentError if the number cannot be parsed as hex and the base is 16" do
+ lambda { Integer("0#{x}g", 16) }.should raise_error(ArgumentError)
+ end
+ end
+
+ %w(b B).each do |b|
+ it "parses the value as a binary number if there's a leading 0#{b} and the base is 2" do
+ Integer("0#{b}1", 2).should == 0b1
+ Integer("0#{b}10", 2).should == 0b10
+ end
+
+ it "is a positive binary number if there's a leading +0#{b} and a base of 2" do
+ Integer("+0#{b}1", 2).should == 0b1
+ Integer("+0#{b}10", 2).should == 0b10
+ end
+
+ it "is a negative binary number if there's a leading -0#{b} and a base of 2" do
+ Integer("-0#{b}1", 2).should == -0b1
+ Integer("-0#{b}10", 2).should == -0b10
+ end
+
+ it "raises an ArgumentError if the number cannot be parsed as binary and the base is 2" do
+ lambda { Integer("0#{b}2", 2) }.should raise_error(ArgumentError)
+ end
+ end
+
+ ["o", "O"].each do |o|
+ it "parses the value as an octal number if there's a leading 0#{o} and a base of 8" do
+ Integer("0#{o}1", 8).should == 0O1
+ Integer("0#{o}10", 8).should == 0O10
+ end
+
+ it "is a positive octal number if there's a leading +0#{o} and a base of 8" do
+ Integer("+0#{o}1", 8).should == 0O1
+ Integer("+0#{o}10", 8).should == 0O10
+ end
+
+ it "is a negative octal number if there's a leading -0#{o} and a base of 8" do
+ Integer("-0#{o}1", 8).should == -0O1
+ Integer("-0#{o}10", 8).should == -0O10
+ end
+
+ it "raises an ArgumentError if the number cannot be parsed as octal and the base is 8" do
+ lambda { Integer("0#{o}9", 8) }.should raise_error(ArgumentError)
+ end
+
+ 2.upto(7) do |base|
+ it "raises an ArgumentError if the number begins with 0#{o} and the base is #{base}" do
+ lambda { Integer("0#{o}1", base) }.should raise_error(ArgumentError)
+ end
+ end
+ end
+
+ %w(D d).each do |d|
+ it "parses the value as a decimal number if there's a leading 0#{d} and a base of 10" do
+ Integer("0#{d}1", 10).should == 1
+ Integer("0#{d}10",10).should == 10
+ end
+
+ it "is a positive decimal number if there's a leading +0#{d} and a base of 10" do
+ Integer("+0#{d}1", 10).should == 1
+ Integer("+0#{d}10", 10).should == 10
+ end
+
+ it "is a negative decimal number if there's a leading -0#{d} and a base of 10" do
+ Integer("-0#{d}1", 10).should == -1
+ Integer("-0#{d}10", 10).should == -10
+ end
+
+ it "raises an ArgumentError if the number cannot be parsed as decimal and the base is 10" do
+ lambda { Integer("0#{d}a", 10) }.should raise_error(ArgumentError)
+ end
+
+ 2.upto(9) do |base|
+ it "raises an ArgumentError if the number begins with 0#{d} and the base is #{base}" do
+ lambda { Integer("0#{d}1", base) }.should raise_error(ArgumentError)
+ end
+ end
+ end
+end
+
describe "Kernel.Integer" do
it_behaves_like :kernel_integer, :Integer, Kernel
it_behaves_like "Integer() given a String", :Integer
+ ruby_version_is "1.9" do
+ it_behaves_like "Integer() given a String and base", :Integer
+ end
it "is a public method" do
Kernel.Integer(10).should == 10
@@ -282,6 +511,9 @@
describe "Kernel#Integer" do
it_behaves_like :kernel_integer, :Integer, Object.new
it_behaves_like "Integer() given a String", :Integer
+ ruby_version_is "1.9" do
+ it_behaves_like "Integer() given a String and base", :Integer
+ end
it "is a private method" do
Kernel.should have_private_instance_method(:Integer)
Modified: MacRuby/trunk/spec/frozen/core/kernel/define_singleton_method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/define_singleton_method_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/kernel/define_singleton_method_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -19,6 +19,28 @@
it "adds the new method to the methods list" do
DefineSingletonMethodSpecClass.should have_method(:another_test_method)
end
+
+ ruby_bug "redmine:2117", "1.8.7" do
+ it "defines any Child class method from any Parent's class methods" do
+ um = KernelSpecs::Parent.method(:parent_class_method).unbind
+ KernelSpecs::Child.send :define_singleton_method, :child_class_method, um
+ KernelSpecs::Child.child_class_method.should == :foo
+ lambda{KernelSpecs::Parent.child_class_method}.should raise_error(NoMethodError)
+ end
+
+ it "will raise when attempting to define an object's singleton method from another objetc's singleton method" do
+ other = KernelSpecs::Parent.new
+ p = KernelSpecs::Parent.new
+ class << p
+ def singleton_method
+ :single
+ end
+ end
+ um = p.method(:singleton_method).unbind
+ lambda{ other.send :define_singleton_method, :other_singleton_method, um }.should raise_error(TypeError)
+ end
+ end
+
end
it "defines a new method with the given name and the given block as body in self" do
Modified: MacRuby/trunk/spec/frozen/core/kernel/equal_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/equal_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/kernel/equal_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -11,6 +11,9 @@
(nil.equal? nil).should == true
(o1.equal? nil).should== false
(nil.equal? o2).should== false
+ ('stuff'.equal? 'stuff').should == false
+ (true.equal? true).should == true
+ (false.equal? false).should == true
end
it "returns true if obj and anObject have the same value." do
@@ -29,6 +32,32 @@
o1.equal?(o2).should be_false
end
+ it "is unaffected by overriding ==" do
+ # different objects, overriding == to return true
+ o1 = mock("object")
+ o1.stub!(:==).and_return(true)
+ o2 = mock("object")
+ o1.equal?(o2).should be_false
+
+ # same objects, overriding == to return false
+ o3 = mock("object")
+ o3.stub!(:==).and_return(false)
+ o3.equal?(o3).should be_true
+ end
+
+ it "is unaffected by overriding eql?" do
+ # different objects, overriding eql? to return true
+ o1 = mock("object")
+ o1.stub!(:eql?).and_return(true)
+ o2 = mock("object")
+ o1.equal?(o2).should be_false
+
+ # same objects, overriding eql? to return false
+ o3 = mock("object")
+ o3.stub!(:eql?).and_return(false)
+ o3.equal?(o3).should be_true
+ end
+
it "is unaffected by overriding __id__" do
o1 = mock("object")
o1.stub!(:__id__).and_return(10)
Modified: MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/kernel/fixtures/classes.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -212,6 +212,7 @@
include ParentMixin
def parent_method; end
def another_parent_method; end
+ def self.parent_class_method; :foo; end
end
class Child < Parent
Modified: MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/kernel/load_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -111,7 +111,7 @@
$LOADED_FEATURES.grep(/load_spec_3.rb/).should == []
end
- ruby_version_is ""..."1.8.7" do
+ ruby_version_is ""..."1.9" do
it "returns __FILE__ as a relative path" do
Dir.chdir($load_fixture_dir) do |dir|
load('load_spec_4.rb')
@@ -120,7 +120,7 @@
end
end
- ruby_version_is "1.8.7" do
+ ruby_version_is "1.9" do
it "returns __FILE__ as an absolute path" do
Dir.chdir($load_fixture_dir) do |dir|
load('load_spec_4.rb')
Added: MacRuby/trunk/spec/frozen/core/kernel/respond_to_missing_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/kernel/respond_to_missing_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/kernel/respond_to_missing_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,86 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes'
+
+ruby_version_is "1.9" do
+ describe "Kernel#respond_to_missing?" do
+ before :each do
+ @a = KernelSpecs::A.new
+ end
+
+ it "returns false by default" do
+ Object.new.respond_to_missing?.should be_false
+ end
+
+ it "is not called when #respond_to? would return true" do
+ obj = mock('object')
+ obj.stub!(:glark)
+ obj.should_not_receive(:respond_to_missing?)
+ obj.respond_to?(:glark).should be_true
+ end
+
+ it "is called when #respond_to? would return false" do
+ obj = mock('object')
+ obj.should_receive(:respond_to_missing?).with(:undefined_method)
+ obj.respond_to?(:undefined_method)
+ end
+
+ it "is called with true as the second argument when #respond_to? is" do
+ obj = mock('object')
+ obj.should_receive(:respond_to_missing?).with(:undefined_method, true)
+ obj.respond_to?(:undefined_method, true)
+ end
+
+ it "causes #respond_to? to return true if called and not returning false" do
+ obj = mock('object')
+ obj.should_receive(:respond_to_missing?).with(:undefined_method).and_return(:glark)
+ obj.respond_to?(:undefined_method).should be_true
+ end
+
+ it "causes #respond_to? to return false if called and returning false" do
+ obj = mock('object')
+ obj.should_receive(:respond_to_missing?).with(:undefined_method).and_return(false)
+ obj.respond_to?(:undefined_method).should be_false
+ end
+
+ it "is not called with false as a second argument when #respond_to? is" do
+ obj = mock('object')
+ obj.should_receive(:respond_to_missing?).with(:undefined_method)
+ obj.respond_to?(:undefined_method, false)
+ end
+
+ it "isn't called when obj responds to the given public method" do
+ @a.should_not_receive(:respond_to_missing?)
+ @a.respond_to?(:pub_method).should be_true
+ end
+
+ it "isn't called when obj responds to the given public method, include_private = true" do
+ @a.should_not_receive(:respond_to_missing?)
+ @a.respond_to?(:pub_method, true).should be_true
+ end
+
+ it "isn't called when obj responds to the given protected method" do
+ @a.should_not_receive(:respond_to_missing?)
+ @a.respond_to?(:protected_method, false).should be_true
+ end
+
+ it "isn't called when obj responds to the given protected method, include_private = true" do
+ @a.should_not_receive(:respond_to_missing?)
+ @a.respond_to?(:protected_method, true).should be_true
+ end
+
+ it "is called when obj responds to the given private method, include_private = false" do
+ @a.should_receive(:respond_to_missing?).with(:private_method)
+ @a.respond_to?(:private_method)
+ end
+
+ it "isn't called when obj responds to the given private method, include_private = true" do
+ @a.should_not_receive(:respond_to_missing?)
+ @a.respond_to?(:private_method, true).should be_true
+ end
+
+ it "is called for missing class methods" do
+ @a.class.should_receive(:respond_to_missing?).with(:oOoOoO)
+ @a.class.respond_to?(:oOoOoO)
+ end
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/matchdata/eql_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/eql_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/eql_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/shared/eql'
+
+ruby_version_is "1.9" do
+ describe "MatchData#eql?" do
+ it_behaves_like(:matchdata_eql, :eql?)
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/matchdata/equal_value_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/equal_value_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/equal_value_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/shared/eql'
+
+ruby_version_is "1.9" do
+ describe "MatchData#==" do
+ it_behaves_like(:matchdata_eql, :==)
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/matchdata/names_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/names_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/names_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,3 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+language_version __FILE__, "names"
Added: MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/regexp_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,15 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.9" do
+ describe "MatchData#regexp" do
+ it "returns a Regexp object" do
+ m = 'haystack'.match(/hay/)
+ m.regexp.should be_an_instance_of(Regexp)
+ end
+
+ it "returns the pattern used in the match" do
+ m = 'haystack'.match(/hay/)
+ m.regexp.should == /hay/
+ end
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/matchdata/shared/eql.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/shared/eql.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/shared/eql.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,26 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe :matchdata_eql, :shared => true do
+ it "returns true if both operands have equal target strings, patterns, and match positions" do
+ a = 'haystack'.match(/hay/)
+ b = 'haystack'.match(/hay/)
+ a.send(@method, b).should be_true
+ end
+
+ it "returns false if the operands have different target strings" do
+ a = 'hay'.match(/hay/)
+ b = 'haystack'.match(/hay/)
+ a.send(@method, b).should be_false
+ end
+
+ it "returns false if the operands have different patterns" do
+ a = 'haystack'.match(/h.y/)
+ b = 'haystack'.match(/hay/)
+ a.send(@method, b).should be_false
+ end
+
+ it "returns false if the argument is not a MatchData object" do
+ a = 'haystack'.match(/hay/)
+ a.send(@method, Object.new).should be_false
+ end
+end
Added: MacRuby/trunk/spec/frozen/core/matchdata/versions/names_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/matchdata/versions/names_1.9.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/matchdata/versions/names_1.9.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,33 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe "MatchData#names" do
+ it "returns an Array" do
+ md = 'haystack'.match(/(?<yellow>hay)/)
+ md.names.should be_an_instance_of(Array)
+ end
+
+ it "sets each element to a String" do
+ 'haystack'.match(/(?<yellow>hay)/).names.all? do |e|
+ e.should be_an_instance_of(String)
+ end
+ end
+
+ it "returns the names of the named capture groups" do
+ md = 'haystack'.match(/(?<yellow>hay).(?<pin>tack)/)
+ md.names.should == ['yellow', 'pin']
+ end
+
+ it "returns [] if there were no named captures" do
+ 'haystack'.match(/(hay).(tack)/).names.should == []
+ end
+
+ it "returns each name only once" do
+ md = 'haystack'.match(/(?<hay>hay)(?<dot>.)(?<hay>tack)/)
+ md.names.should == ['hay', 'dot']
+ end
+
+ it "equals Regexp#names" do
+ r = /(?<hay>hay)(?<dot>.)(?<hay>tack)/
+ 'haystack'.match(r).names.should == r.names
+ end
+end
Modified: MacRuby/trunk/spec/frozen/core/method/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/method/fixtures/classes.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/method/fixtures/classes.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -24,8 +24,17 @@
def foo
true
end
+
alias bar foo
+ def same_as_foo
+ true
+ end
+
+ def respond_to_missing? method
+ [:handled_via_method_missing, :also_handled].include? method
+ end
+
attr_accessor :attr
def zero; end
Modified: MacRuby/trunk/spec/frozen/core/method/name_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/method/name_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/method/name_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,11 +2,24 @@
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Method#name" do
- ruby_version_is '1.8.7' do
+ ruby_version_is '1.8.7'..'1.9' do
it "returns the name of the method" do
+ "abc".method(:upcase).name.should == "upcase"
+ end
+
+ it "returns the name even when aliased" do
+ obj = MethodSpecs::Methods.new
+ obj.method(:foo).name.should == "foo"
+ obj.method(:bar).name.should == "bar"
+ obj.method(:bar).unbind.bind(obj).name.should == "bar"
+ end
+ end
+
+ ruby_version_is '1.9' do
+ it "returns the name of the method" do
"abc".method(:upcase).name.should == :upcase
end
-
+
it "returns the name even when aliased" do
obj = MethodSpecs::Methods.new
obj.method(:foo).name.should == :foo
@@ -14,4 +27,5 @@
obj.method(:bar).unbind.bind(obj).name.should == :bar
end
end
+
end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/core/method/shared/eql.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/method/shared/eql.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/method/shared/eql.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -4,61 +4,86 @@
describe :method_equal, :shared => true do
before(:each) do
@m = MethodSpecs::Methods.new
+ @m_foo = @m.method(:foo)
@m2 = MethodSpecs::Methods.new
@a = MethodSpecs::A.new
end
it "returns true if methods are the same" do
- m1 = @m.method(:foo)
m2 = @m.method(:foo)
- m1.send(@method, m1).should be_true
- m1.send(@method, m2).should be_true
+ @m_foo.send(@method, @m_foo).should be_true
+ @m_foo.send(@method, m2).should be_true
end
it "returns true on aliased methods" do
- m1 = @m.method(:foo)
- m2 = @m.method(:bar)
+ m_bar = @m.method(:bar)
- m1.send(@method, m2).should be_true
+ m_bar.send(@method, @m_foo).should be_true
end
ruby_version_is "1.9" do
- it "returns true if the two methods are alises of each other in C" do
- a = String.instance_method(:size)
- b = String.instance_method(:length)
+ it "returns true if the two core methods are aliases" do
+ s = "hello"
+ a = s.method(:size)
+ b = s.method(:length)
a.send(@method, b).should be_true
end
end
it "returns false on a method which is neither aliased nor the same method" do
- m1 = @m.method(:foo)
m2 = @m.method(:zero)
- (m1 == m2).should be_false
+ @m_foo.send(@method, m2).should be_false
end
it "returns false for a method which is not bound to the same object" do
- m1 = @m.method(:foo)
- m2 = @m2.method(:foo)
-
- a = @a.method(:baz)
+ m2_foo = @m2.method(:foo)
+ a_baz = @a.method(:baz)
- m1.send(@method, m2).should be_false
- m1.send(@method, a).should be_false
- m2.send(@method, a).should be_false
+ @m_foo.send(@method, m2_foo).should be_false
+ @m_foo.send(@method, a_baz).should be_false
end
- it "returns false if the two methods are bound to the same object but have different bodies" do
- a = MethodSpecs::Eql.instance_method(:different_body)
- b = MethodSpecs::Eql.instance_method(:same_body)
- a.send(@method, b).should be_false
+ it "returns false if the two methods are bound to the same object but were defined independently" do
+ m2 = @m.method(:same_as_foo)
+ @m_foo.send(@method, m2).should be_false
end
- it "returns false if the two methods are bound to different objects, have different names, but identical bodies" do
- a = MethodSpecs::Eql.instance_method(:same_body_two)
- b = MethodSpecs::Eql2.instance_method(:same_body)
- a.send(@method, b).should be_false
+ ruby_version_is "1.9" do
+ it "returns true if a method was defined using the other one" do
+ MethodSpecs::Methods.send :define_method, :defined_foo, MethodSpecs::Methods.instance_method(:foo)
+ m2 = @m.method(:defined_foo)
+ @m_foo.send(@method, m2).should be_true
+ end
+
+ it "returns true for methods defined using the same block/proc" do
+ class MethodSpecs::Methods
+ p = Proc.new { :cool }
+ define_method :proc1, p
+ define_method :proc2, p
+
+ define_method :block1, &p
+ define_method :block2, &p
+ end
+ proc1 = @m.method :proc1
+ proc2 = @m.method :proc2
+ block1 = @m.method :proc1
+ block2 = @m.method :proc2
+
+ proc1.send(@method, proc2).should be_true
+ block1.send(@method, block2).should be_true
+ proc1.send(@method, block1).should be_true
+ end
+
+ it "returns true for the same method missing" do
+ miss1 = @m.method(:handled_via_method_missing)
+ miss1bis = @m.method(:handled_via_method_missing)
+ miss2 = @m.method(:also_handled)
+
+ miss1.send(@method, miss1bis).should be_true
+ miss1.send(@method, miss2).should be_false
+ end
end
it "returns false if the two methods are bound to different objects, have the same names, and identical bodies" do
Modified: MacRuby/trunk/spec/frozen/core/module/attr_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/module/attr_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/module/attr_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -25,66 +25,64 @@
o.send(:attr3).should == "test3"
end
- ruby_version_is "" .. "1.9" do
- it "creates a setter for the given attribute name if writable is true" do
- c = Class.new do
- attr :attr, true
- attr "attr3", true
+ it "creates a setter for the given attribute name if writable is true" do
+ c = Class.new do
+ attr :attr, true
+ attr "attr3", true
- def initialize
- @attr, @attr2, @attr3 = "test", "test2", "test3"
- end
+ def initialize
+ @attr, @attr2, @attr3 = "test", "test2", "test3"
end
+ end
- o = c.new
+ o = c.new
- %w{attr attr3}.each do |a|
- o.respond_to?(a).should == true
- o.respond_to?("#{a}=").should == true
- end
-
- o.attr = "test updated"
- o.attr3 = "test3 updated"
+ %w{attr attr3}.each do |a|
+ o.respond_to?(a).should == true
+ o.respond_to?("#{a}=").should == true
end
+
+ o.attr = "test updated"
+ o.attr3 = "test3 updated"
+ end
- it "creates a getter and setter for the given attribute name if called with and without writeable is true" do
- c = Class.new do
- attr :attr, true
- attr :attr
+ it "creates a getter and setter for the given attribute name if called with and without writeable is true" do
+ c = Class.new do
+ attr :attr, true
+ attr :attr
- attr "attr3", true
- attr "attr3"
+ attr "attr3", true
+ attr "attr3"
- def initialize
- @attr, @attr2, @attr3 = "test", "test2", "test3"
- end
+ def initialize
+ @attr, @attr2, @attr3 = "test", "test2", "test3"
end
+ end
- o = c.new
+ o = c.new
- %w{attr attr3}.each do |a|
- o.respond_to?(a).should == true
- o.respond_to?("#{a}=").should == true
- end
+ %w{attr attr3}.each do |a|
+ o.respond_to?(a).should == true
+ o.respond_to?("#{a}=").should == true
+ end
- o.attr.should == "test"
- o.attr = "test updated"
- o.attr.should == "test updated"
+ o.attr.should == "test"
+ o.attr = "test updated"
+ o.attr.should == "test updated"
- o.attr3.should == "test3"
- o.attr3 = "test3 updated"
- o.attr3.should == "test3 updated"
- end
+ o.attr3.should == "test3"
+ o.attr3 = "test3 updated"
+ o.attr3.should == "test3 updated"
+ end
- it "applies current visibility to methods created" do
- c = Class.new do
- protected
- attr :foo, true
- end
-
- lambda { c.new.foo }.should raise_error(NoMethodError)
- lambda { c.new.foo=1 }.should raise_error(NoMethodError)
+ it "applies current visibility to methods created" do
+ c = Class.new do
+ protected
+ attr :foo, true
end
+
+ lambda { c.new.foo }.should raise_error(NoMethodError)
+ lambda { c.new.foo=1 }.should raise_error(NoMethodError)
end
ruby_version_is "1.9" do
Modified: MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/module/define_method_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -12,7 +12,7 @@
end
define_method(:another_test_method, instance_method(:test_method))
end
-
+
klass.new.another_test_method(1, 2).should == [1, 2]
end
@@ -25,50 +25,84 @@
end
klass.new.should have_method(:another_test_method)
end
+
+ ruby_bug "redmine:2117", "1.8.7" do
+ it "works for singleton classes too" do
+ klass = Class.new
+ class << klass
+ def test_method
+ :foo
+ end
+ end
+ child = Class.new(klass)
+ sc = class << child; self; end
+ sc.send :define_method, :another_test_method, klass.method(:test_method).unbind
+ child.another_test_method.should == :foo
+ end
+ end
end
describe "Module#define_method" do
it "defines the given method as an instance method with the given name in self" do
class DefineMethodSpecClass
def test1
- "test"
+ "test"
end
define_method(:another_test, instance_method(:test1))
end
-
+
o = DefineMethodSpecClass.new
o.test1.should == o.another_test
end
-
+
it "defines a new method with the given name and the given block as body in self" do
class DefineMethodSpecClass
define_method(:block_test1) { self }
define_method(:block_test2, &lambda { self })
end
-
+
o = DefineMethodSpecClass.new
o.block_test1.should == o
o.block_test2.should == o
end
-
+
it "raises a TypeError when the given method is no Method/Proc" do
lambda {
Class.new { define_method(:test, "self") }
}.should raise_error(TypeError)
-
+
lambda {
Class.new { define_method(:test, 1234) }
}.should raise_error(TypeError)
end
-
+
+ it "accepts a Method (still bound)" do
+ class DefineMethodSpecClass
+ attr_accessor :data
+ def inspect_data
+ "data is #{@data}"
+ end
+ end
+ o = DefineMethodSpecClass.new
+ o.data = :foo
+ m = o.method(:inspect_data)
+ m.should be_an_instance_of(Method)
+ klass = Class.new(DefineMethodSpecClass)
+ klass.send(:define_method,:other_inspect, m)
+ c = klass.new
+ c.data = :bar
+ c.other_inspect.should == "data is bar"
+ lambda{o.other_inspect}.should raise_error(NoMethodError)
+ end
+
it "should maintain the Proc's scope" do
class DefineMethodByProcClass
in_scope = true
method_proc = proc { in_scope }
-
+
define_method(:proc_test, &method_proc)
end
-
+
o = DefineMethodByProcClass.new
o.proc_test.should == true
end
Modified: MacRuby/trunk/spec/frozen/core/proc/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/proc/new_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/proc/new_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -9,9 +9,10 @@
# This raises a ThreadError on 1.8 HEAD. Reported as bug #1707
it "raises a LocalJumpError when context of the block no longer exists" do
- def some_method(&b) b end
- a_proc = Proc.new { return }
- res = some_method(&a_proc)
+ def some_method
+ Proc.new { return }
+ end
+ res = some_method()
# Using raise_error here causes 1.9 to hang, so we roll our own
# begin/rescue block to verify that the exception is raised.
Modified: MacRuby/trunk/spec/frozen/core/string/encode_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/encode_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/string/encode_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -8,7 +8,8 @@
Encoding.default_internal = Encoding::EUC_JP
str = "問か".force_encoding('utf-8')
str.encoding.should_not == Encoding.default_internal
- str.encode.encoding.should == Encoding.default_internal
+ str.encode!
+ str.encoding.should == Encoding.default_internal
ensure
Encoding.default_internal = old_default_internal
end
@@ -131,6 +132,30 @@
"foo".freeze.encode!("foo".encoding)
end.should raise_error(RuntimeError)
end
+
+ it "replaces invalid characters" do
+ str = "\222\xA1x"
+ str.encode!("iso-2022-jp", "stateless-iso-2022-jp", :invalid => :replace)
+ str.should == "?x".force_encoding("iso-2022-jp")
+ end
+
+ it "replaces undefined characters" do
+ str = "abc\u{fffd}def"
+ str.encode!("EUC-JP", "UTF-8", {:undef => :replace, :replace => ""})
+ str.should == "abcdef"
+ end
+
+ it "replaces xml characters" do
+ str = '<xml>bed & breakfast</xml>'
+ str.encode!('UTF-8', {:xml => :text})
+ str.should == "<xml>bed & breakfast</xml>"
+ end
+
+ it "replaces xml characters and quotes the result" do
+ str = '<xml>bed & breakfast</xml>'
+ str.encode!('UTF-8', {:xml => :attr})
+ str.should == "\"<xml>bed & breakfast</xml>\""
+ end
end
describe "String#encode" do
@@ -141,8 +166,7 @@
Encoding.default_internal = Encoding::EUC_JP
str = "問か".force_encoding('utf-8')
str.encoding.should_not == Encoding.default_internal
- str.encode!
- str.encoding.should == Encoding.default_internal
+ str.encode.encoding.should == Encoding.default_internal
ensure
Encoding.default_internal = old_default_internal
end
@@ -256,6 +280,21 @@
"\u{9878}".encode('xyz')
end.should raise_error(Encoding::ConverterNotFoundError)
end
+
+ it "replaces invalid characters" do
+ "\222\xA1x".encode("iso-2022-jp", "stateless-iso-2022-jp", :invalid => :replace).should == "?x".force_encoding("iso-2022-jp")
+ end
+
+ it "replaces undefined characters" do
+ "abc\u{fffd}def".encode("EUC-JP", "UTF-8", {:undef => :replace, :replace => ""}).should == "abcdef"
+ end
+ it "replaces xml characters" do
+ '<xml>bed & breakfast</xml>'.encode('UTF-8', {:xml => :text}).should == "<xml>bed & breakfast</xml>"
+ end
+
+ it "replaces xml characters and quotes the result" do
+ '<xml>bed & breakfast</xml>'.encode('UTF-8', {:xml => :attr}).should == "\"<xml>bed & breakfast</xml>\""
+ end
end
end
Modified: MacRuby/trunk/spec/frozen/core/string/equal_value_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/equal_value_spec_disabled.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/string/equal_value_spec_disabled.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -24,4 +24,8 @@
('hello' == obj).should == true
end
+
+ it "is not fooled by NUL characters" do
+ "abc\0def".should_not == "abc\0xyz"
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/string/inspect_spec_disabled.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -10,9 +10,13 @@
end
end
ruby_version_is "1.9" do
- it "returns a string with nonprinting charaters replaced by \\x notation" do
+ it "returns a string with nonprinting characters replaced by \\x notation" do
("\000".."A").to_a.join('').should == "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\e\x1C\x1D\x1E\x1F !\"\#$%&'()*+,-./0123456789:;<=>?@A"
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\""
+ end
end
# $KCODE is deprecated/removed on 1.9
Modified: MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/struct/hash_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -17,4 +17,14 @@
car.hash.should == similar_car.hash
end
+ ruby_bug "redmine #1852", "1.9.1" do
+ it "returns the same hash for recursive structs" do
+ car = Struct::Car.new("Honda", "Accord", "1998")
+ similar_car = Struct::Car.new("Honda", "Accord", "1998")
+ car[:make] = car
+ similar_car[:make] = car
+ car.hash.should == similar_car.hash
+ end
+ end
+
end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/core/struct/inspect_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/inspect_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/struct/inspect_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,5 +1,6 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
+require File.dirname(__FILE__) + '/shared/inspect'
describe "Struct#inspect" do
it "returns a string representation of some kind" do
@@ -12,4 +13,6 @@
::Whiskey = Struct.new(:name, :ounces)
::Whiskey.new('Jack', 100).inspect.should == '#<struct Whiskey name="Jack", ounces=100>'
end
+
+ it_behaves_like(:struct_inspect, :inspect)
end
Added: MacRuby/trunk/spec/frozen/core/struct/shared/inspect.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/shared/inspect.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/core/struct/shared/inspect.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,13 @@
+describe :struct_inspect, :shared => true do
+ ruby_version_is "1.9" do
+ it "returns a string representation without the class name for anonymous structs" do
+ Struct.new(:a).new("").send(@method).should == '#<struct a="">'
+ end
+ end
+
+ ruby_version_is ""..."1.9" do
+ it "returns a string representation with the class name for anonymous structs" do
+ Struct.new(:a).new("").send(@method).should =~ /#<struct #<Class:[^>]+> a=\"\">/
+ end
+ end
+end
Modified: MacRuby/trunk/spec/frozen/core/struct/to_s_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/struct/to_s_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/struct/to_s_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,9 +1,12 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
+require File.dirname(__FILE__) + '/shared/inspect'
describe "Struct#to_s" do
it "is a synonym for inspect" do
car = Struct::Car.new('Ford', 'Ranger')
car.inspect.should == car.to_s
end
+
+ it_behaves_like(:struct_inspect, :to_s)
end
Modified: MacRuby/trunk/spec/frozen/core/thread/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/fixtures/classes.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/thread/fixtures/classes.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -150,7 +150,7 @@
t = Thread.new do
begin
begin
- Thread.current.send(@method)
+ Thread.current.send(kill_method_name)
ensure
raise "In dying thread"
end
Modified: MacRuby/trunk/spec/frozen/core/thread/join_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/join_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/thread/join_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -46,9 +46,11 @@
end
ruby_version_is "" ... "1.9" do
- it "returns the dead thread even if an uncaught exception is thrown from ensure block" do
- t = ThreadSpecs.dying_thread_ensures { raise "In dying thread" }
- t.join.should equal(t)
+ not_compliant_on :rubinius do
+ it "returns the dead thread even if an uncaught exception is thrown from ensure block" do
+ t = ThreadSpecs.dying_thread_ensures { raise "In dying thread" }
+ t.join.should equal(t)
+ end
end
end
Modified: MacRuby/trunk/spec/frozen/core/thread/key_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/key_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/thread/key_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -16,10 +16,12 @@
@th.key?(:stanley.to_s).should == false
end
- ruby_version_is ""..."1.9" do
- it "raises exceptions on the wrong type of keys" do
- lambda { Thread.current.key? nil }.should raise_error(TypeError)
- lambda { Thread.current.key? 5 }.should raise_error(ArgumentError)
+ quarantine! do
+ ruby_version_is ""..."1.9" do
+ it "raises exceptions on the wrong type of keys" do
+ lambda { Thread.current.key? nil }.should raise_error(TypeError)
+ lambda { Thread.current.key? 5 }.should raise_error(ArgumentError)
+ end
end
end
Modified: MacRuby/trunk/spec/frozen/core/thread/shared/exit.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/shared/exit.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/thread/shared/exit.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -100,22 +100,25 @@
t.join
ScratchPad.recorded.should == :after_stop
end
-
- it "propogates inner exception to Thread.join if there is an outer ensure clause" do
- thread = ThreadSpecs.dying_thread_with_outer_ensure(@method) { }
- lambda { thread.join }.should raise_error(RuntimeError, "In dying thread")
+
+ quarantine! do
+
+ it "propogates inner exception to Thread.join if there is an outer ensure clause" do
+ thread = ThreadSpecs.dying_thread_with_outer_ensure(@method) { }
+ lambda { thread.join }.should raise_error(RuntimeError, "In dying thread")
+ end
+
+ it "runs all outer ensure clauses even if inner ensure clause raises exception" do
+ thread = ThreadSpecs.join_dying_thread_with_outer_ensure(@method) { ScratchPad.record :in_outer_ensure_clause }
+ ScratchPad.recorded.should == :in_outer_ensure_clause
+ end
+
+ it "sets $! in outer ensure clause if inner ensure clause raises exception" do
+ thread = ThreadSpecs.join_dying_thread_with_outer_ensure(@method) { ScratchPad.record $! }
+ ScratchPad.recorded.to_s.should == "In dying thread"
+ end
end
-
- it "runs all outer ensure clauses even if inner ensure clause raises exception" do
- thread = ThreadSpecs.join_dying_thread_with_outer_ensure(@method) { ScratchPad.record :in_outer_ensure_clause }
- ScratchPad.recorded.should == :in_outer_ensure_clause
- end
-
- it "sets $! in outer ensure clause if inner ensure clause raises exception" do
- thread = ThreadSpecs.join_dying_thread_with_outer_ensure(@method) { ScratchPad.record $! }
- ScratchPad.recorded.to_s.should == "In dying thread"
- end
-
+
it "can be rescued by outer rescue clause when inner ensure clause raises exception" do
thread = Thread.new do
begin
Modified: MacRuby/trunk/spec/frozen/core/thread/value_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/thread/value_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/thread/value_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -26,9 +26,11 @@
end
ruby_version_is "" ... "1.9" do
- it "is false for an uncaught exception thrown from a dying thread" do
- t = ThreadSpecs.dying_thread_ensures { 1/0 }
- t.value.should == false
+ not_compliant_on :rubinius do
+ it "is false for an uncaught exception thrown from a dying thread" do
+ t = ThreadSpecs.dying_thread_ensures { 1/0 }
+ t.value.should == false
+ end
end
end
end
Modified: MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/time/shared/time_params.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -36,10 +36,21 @@
end
platform_is :wordsize => 64 do
- Time.send(@method, 1900, 12, 31, 23, 59, 59, 0).wday.should == 1
+ darwin = false
+ platform_is :darwin do
+ not_compliant_on :jruby do # JRuby exhibits platform-independent behavior
+ darwin = true
+ lambda { Time.send(@method, 1900, 12, 31, 23, 59, 59, 0) }.should raise_error(ArgumentError) # mon
+ end
+ end
+
+ unless darwin
+ Time.send(@method, 1900, 12, 31, 23, 59, 59, 0).wday.should == 1
+ end
+
Time.send(@method, 2038, 12, 31, 23, 59, 59, 0).wday.should == 5
end
- end
+ end
it "raises an ArgumentError for out of range values" do
# year-based Time.local(year (, month, day, hour, min, sec, usec))
Modified: MacRuby/trunk/spec/frozen/core/time/strftime_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/time/strftime_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/time/strftime_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -84,6 +84,76 @@
time = Time.local(2004, 8, 26, 11, 38, 3)
time.strftime('%p').should == 'AM'
end
+
+ it "returns the abbreviated weekday with %a" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%a').should == 'Fri'
+ end
+
+ it "returns the full weekday with %A" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%A').should == 'Friday'
+ end
+
+ it "returns the abbreviated month with %b" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%b').should == 'Sep'
+ end
+
+ it "returns the full month with %B" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%B').should == 'September'
+ end
+
+ it "returns the day of the month with %d" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%d').should == '18'
+ end
+
+ it "returns the 24-based hour with %H" do
+ time = Time.local(2009, 9, 18, 18, 0, 0)
+ time.strftime('%H').should == '18'
+ end
+
+ it "returns the 12-based hour with %I" do
+ time = Time.local(2009, 9, 18, 18, 0, 0)
+ time.strftime('%I').should == '06'
+ end
+
+ it "returns the Julian date with %j" do
+ time = Time.local(2009, 9, 18, 18, 0, 0)
+ time.strftime('%j').should == '261'
+ end
+
+ it "returns the month with %m" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%m').should == '09'
+ end
+
+ it "returns the minute with %M" do
+ time = Time.local(2009, 9, 18, 12, 6, 0)
+ time.strftime('%M').should == '06'
+ end
+
+ it "returns the second with %S" do
+ time = Time.local(2009, 9, 18, 12, 0, 6)
+ time.strftime('%S').should == '06'
+ end
+
+ it "returns the enumerated day of the week with %w" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%w').should == '5'
+ end
+
+ it "returns the year wihout a century with %y" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%y').should == '09'
+ end
+
+ it "returns the year with %Y" do
+ time = Time.local(2009, 9, 18, 12, 0, 0)
+ time.strftime('%Y').should == '2009'
+ end
ruby_version_is "1.9" .. "" do
it "supports am/pm formatting with %P" do
@@ -93,4 +163,32 @@
time.strftime('%P').should == 'am'
end
end
+
+ ruby_version_is '1.9' do
+ it "supports GNU modificators" do
+ time = Time.local(2001, 2, 3, 4, 5, 6)
+
+ time.strftime('%^h').should == 'FEB'
+ time.strftime('%^_5h').should == ' FEB'
+ time.strftime('%0^5h').should == '00FEB'
+ time.strftime('%04H').should == '0004'
+ time.strftime('%0-^5h').should == 'FEB'
+ time.strftime('%_-^5h').should == 'FEB'
+ time.strftime('%^ha').should == 'FEBa'
+
+ expected = {
+ "%10h" => ' Feb',
+ "%^10h" => ' FEB',
+ "%_10h" => ' Feb',
+ "%_010h" => '0000000Feb',
+ "%0_10h" => ' Feb',
+ "%0_-10h" => 'Feb',
+ "%0-_10h" => 'Feb'
+ }
+
+ ["%10h","%^10h","%_10h","%_010h","%0_10h","%0_-10h","%0-_10h"].each do |format|
+ time.strftime(format).should == expected[format]
+ end
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/bind_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -34,4 +34,24 @@
obj = UnboundMethodSpecs::Methods.new
@normal_um.bind(obj).call.should == obj.foo
end
+
+ ruby_bug "redmine:2117", "1.8.7" do
+ it "binds a Parent's class method to any Child's class methods" do
+ m = UnboundMethodSpecs::Parent.method(:class_method).unbind.bind(UnboundMethodSpecs::Child1)
+ m.should be_an_instance_of(Method)
+ m.call.should == "I am UnboundMethodSpecs::Child1"
+ end
+
+ it "will raise when binding a an object singleton's method to another object" do
+ other = UnboundMethodSpecs::Parent.new
+ p = UnboundMethodSpecs::Parent.new
+ class << p
+ def singleton_method
+ :single
+ end
+ end
+ um = p.method(:singleton_method).unbind
+ lambda{ um.bind(other) }.should raise_error(TypeError)
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/fixtures/classes.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/fixtures/classes.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/fixtures/classes.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -32,6 +32,9 @@
class Parent
def foo; end
+ def self.class_method
+ "I am #{name}"
+ end
end
class Child1 < Parent; end
Modified: MacRuby/trunk/spec/frozen/core/unboundmethod/name_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/unboundmethod/name_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/core/unboundmethod/name_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,11 +2,24 @@
require File.dirname(__FILE__) + '/fixtures/classes'
describe "UnboundMethod#name" do
- ruby_version_is '1.8.7' do
+ ruby_version_is '1.8.7'..'1.9' do
it "returns the name of the method" do
+ String.instance_method(:upcase).name.should == "upcase"
+ end
+
+ it "returns the name even when aliased" do
+ obj = UnboundMethodSpecs::Methods.new
+ obj.method(:foo).unbind.name.should == "foo"
+ obj.method(:bar).unbind.name.should == "bar"
+ UnboundMethodSpecs::Methods.instance_method(:bar).name.should == "bar"
+ end
+ end
+
+ ruby_version_is '1.9' do
+ it "returns the name of the method" do
String.instance_method(:upcase).name.should == :upcase
end
-
+
it "returns the name even when aliased" do
obj = UnboundMethodSpecs::Methods.new
obj.method(:foo).unbind.name.should == :foo
@@ -14,4 +27,5 @@
UnboundMethodSpecs::Methods.instance_method(:bar).name.should == :bar
end
end
-end
\ No newline at end of file
+
+end
Modified: MacRuby/trunk/spec/frozen/language/defined_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/defined_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/defined_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -181,12 +181,12 @@
# I (Evan) am not certain we'll support defined?(super) ever.
# for now, i'm marking these as compliant.
it "returns 'super' when Subclass#no_args uses defined?" do
- ret = (LanguageDefinedSpecs::LanguageDefinedSubclass.new.no_args)
+ ret = (LanguageDefinedSubclass.new.no_args)
ret.should == "super"
end
it "returns 'super' when Subclass#args uses defined?" do
- ret = (LanguageDefinedSpecs::LanguageDefinedSubclass.new.args)
+ ret = (LanguageDefinedSubclass.new.args)
ret.should == "super"
end
Modified: MacRuby/trunk/spec/frozen/language/ensure_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/ensure_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/ensure_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,74 +2,70 @@
require File.dirname(__FILE__) + '/fixtures/ensure'
describe "An ensure block inside a begin block" do
+ before :each do
+ ScratchPad.record []
+ end
+
it "is executed when an exception is raised in it's corresponding begin block" do
begin
- executed = []
-
lambda {
begin
- executed << :begin
+ ScratchPad << :begin
raise "An exception occured!"
ensure
- executed << :ensure
+ ScratchPad << :ensure
end
}.should raise_error(RuntimeError)
-
- executed.should eql([:begin, :ensure])
+
+ ScratchPad.recorded.should == [:begin, :ensure]
end
end
it "is executed when an exception is raised and rescued in it's corresponding begin block" do
begin
- executed = []
-
begin
- executed << :begin
+ ScratchPad << :begin
raise "An exception occured!"
rescue
- executed << :rescue
+ ScratchPad << :rescue
ensure
- executed << :ensure
+ ScratchPad << :ensure
end
-
- executed.should eql([:begin, :rescue, :ensure])
+
+ ScratchPad.recorded.should == [:begin, :rescue, :ensure]
end
end
it "is executed even when a symbol is thrown in it's corresponding begin block" do
begin
- executed = []
-
catch(:symbol) do
begin
- executed << :begin
+ ScratchPad << :begin
throw(:symbol)
rescue
- executed << :rescue
+ ScratchPad << :rescue
ensure
- executed << :ensure
+ ScratchPad << :ensure
end
end
-
- executed.should eql([:begin, :ensure])
+
+ ScratchPad.recorded.should == [:begin, :ensure]
end
end
it "is executed when nothing is raised or thrown in it's corresponding begin block" do
- executed = []
-
begin
- executed << :begin
+ ScratchPad << :begin
raise "An exception occured!"
rescue
- executed << :rescue
+ ScratchPad << :rescue
ensure
- executed << :ensure
+ ScratchPad << :ensure
end
-
- executed.should eql([:begin, :rescue, :ensure])
+
+ ScratchPad.recorded.should == [:begin, :rescue, :ensure]
end
-
+
it "has non return value" do
begin
:begin
@@ -83,7 +79,7 @@
before(:each) do
@obj = EnsureSpec::Container.new
end
-
+
it "is executed when an exception is raised in the method" do
lambda { @obj.raise_in_method_with_ensure }.should raise_error(RuntimeError)
@obj.executed.should == [:method, :ensure]
@@ -93,17 +89,17 @@
@obj.raise_and_rescue_in_method_with_ensure
@obj.executed.should == [:method, :rescue, :ensure]
end
-
+
it "is executed even when a symbol is thrown in the method" do
catch(:symbol) { @obj.throw_in_method_with_ensure }
@obj.executed.should == [:method, :ensure]
end
-
+
it "has no impact on the method's implicit return value" do
@obj.implicit_return_in_method_with_ensure.should == :method
end
-
+
it "has an impact on the method's explicit return value" do
@obj.explicit_return_in_method_with_ensure.should == :ensure
end
-end
\ No newline at end of file
+end
Modified: MacRuby/trunk/spec/frozen/language/file_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/file_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/file_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -10,8 +10,8 @@
it "equals (eval) inside an eval" do
eval("__FILE__").should == "(eval)"
end
-
- ruby_version_is ""..."1.8.7" do
+
+ ruby_version_is "".."1.9" do
it "equals a relative path when required using a relative path" do
base_path = File.dirname(File.dirname(fixture(__FILE__, "file.rb")))
path = "fixtures/file.rb"
@@ -22,7 +22,7 @@
end
end
- ruby_version_is "1.8.7" do
+ ruby_version_is "1.9" do
it "equals an absolute path when required using a relative path" do
base_path = File.dirname(File.dirname(fixture(__FILE__, "file.rb")))
path = "./fixtures/file.rb"
Modified: MacRuby/trunk/spec/frozen/language/for_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/for_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/for_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -59,23 +59,46 @@
n.should == 3
end
- it "splats multiple arguments together if there are fewer arguments than values" do
- class OFor
- def each
- [[1,2,3], [4,5,6]].each do |a|
- yield(a[0],a[1],a[2])
+ ruby_version_is ""..."1.9" do
+ it "splats multiple arguments together if there are fewer arguments than values" do
+ class OFor
+ def each
+ [[1,2,3], [4,5,6]].each do |a|
+ yield(a[0],a[1],a[2])
+ end
end
end
+ o = OFor.new
+ qs = []
+ for q in o
+ qs << q
+ end
+ qs.should == [[1,2,3], [4,5,6]]
+ q.should == [4,5,6]
end
- o = OFor.new
- qs = []
- for q in o
- qs << q
+ end
+
+ # 1.9 behaviour verified by nobu in
+ # http://redmine.ruby-lang.org/issues/show/2053
+ ruby_version_is "1.9" do
+ it "yields only as many values as there are arguments" do
+ class OFor
+ def each
+ [[1,2,3], [4,5,6]].each do |a|
+ yield(a[0],a[1],a[2])
+ end
+ end
+ end
+ o = OFor.new
+ qs = []
+ for q in o
+ qs << q
+ end
+ qs.should == [1, 4]
+ q.should == 4
end
- qs.should == [[1,2,3], [4,5,6]]
- q.should == [4,5,6]
end
-
+
it "optionally takes a 'do' after the expression" do
j = 0
for i in 1..3 do
Modified: MacRuby/trunk/spec/frozen/language/hash_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/hash_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/hash_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -28,4 +28,14 @@
h.values.should == [nil]
h[:key].should == nil
end
+
+ it "freezes string keys on initialization" do
+ key = "foo"
+ h = {key => "bar"}
+ key.reverse!
+ h["foo"].should == "bar"
+ h.keys.first.should == "foo"
+ h.keys.first.frozen?.should == true
+ key.should == "oof"
+ end
end
Modified: MacRuby/trunk/spec/frozen/language/private_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/private_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/private_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -57,27 +57,33 @@
end
it "changes visibility of previously called method" do
- klass = Private::F
- f = klass.new
+ f = ::Private::F.new
f.foo
- klass.class_eval { private :foo }
+ module ::Private
+ class F
+ private :foo
+ end
+ end
lambda { f.foo }.should raise_error(NoMethodError)
end
it "changes visiblity of previously called methods with same send/call site" do
- klass = Private::G
- g = klass.new
+ g = ::Private::G.new
lambda {
2.times do
g.foo
- klass.class_eval { private :foo }
+ module ::Private
+ class G
+ private :foo
+ end
+ end
end
}.should raise_error(NoMethodError)
end
it "changes the visibility of the existing method in the subclass" do
- Private::A.new.foo.should == 'foo'
- lambda {Private::H.new.foo}.should raise_error(NoMethodError)
- Private::H.new.send(:foo).should == 'foo'
+ ::Private::A.new.foo.should == 'foo'
+ lambda {::Private::H.new.foo}.should raise_error(NoMethodError)
+ ::Private::H.new.send(:foo).should == 'foo'
end
end
Modified: MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/regexp/encoding_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -37,7 +37,7 @@
match.to_a.should == ["\303\251".force_encoding(Encoding::EUC_JP)]
end
- it 'supports /n (Normal encoding)' do
+ it 'supports /n (No encoding)' do
/./n.match("\303\251").to_a.should == ["\303"]
end
@@ -50,6 +50,7 @@
/./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
end
Modified: MacRuby/trunk/spec/frozen/language/regexp/versions/character_classes_1.9.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/regexp/versions/character_classes_1.9.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/regexp/versions/character_classes_1.9.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,5 +1,9 @@
# coding: utf-8
+# The examples below are based on the definitions in
+# http://unicode.org/reports/tr18/ , which was deemed authoritative in
+# http://redmine.ruby-lang.org/issues/show/1889 .
+
it "matches ASCII characters with [[:ascii:]]" do
"\x00".match(/[[:ascii:]]/).to_a.should == ["\x00"]
"\x7F".match(/[[:ascii:]]/).to_a.should == ["\x7F"]
@@ -99,18 +103,14 @@
"\u{16}".match(/[[:cntrl:]]/).to_a.should == ["\u{16}"]
end
-it "matches Unicode format characters with [[:cntrl:]]" do
- "\u{2060}".match(/[[:cntrl:]]/).to_a.should == ["\u{2060}"]
+it "doesn't match Unicode format characters with [[:cntrl:]]" do
+ "\u{2060}".match(/[[:cntrl:]]/).should be_nil
end
-it "matches Unicode private-use characters with [[:cntrl:]]" do
- "\u{E001}".match(/[[:cntrl:]]/).to_a.should == ["\u{E001}"]
+it "doesn't match Unicode private-use characters with [[:cntrl:]]" do
+ "\u{E001}".match(/[[:cntrl:]]/).should be_nil
end
-# Oniguruma claims the below behaviour, but also regards the surrogate
-# characters as "invalid"
-it "matches Unicode surrogate characters with [[:cntrl:]]"
-
it "doesn't match Unicode letter characters with [[:digit:]]" do
"à".match(/[[:digit:]]/).should be_nil
end
@@ -161,15 +161,14 @@
"\u{16}".match(/[[:graph:]]/).should be_nil
end
-it "matches Unicode format characters with [[:graph:]]" do
- "\u{2060}".match(/[[:graph:]]/).to_a.should == ["\u{2060}"]
+it "doesn't match Unicode format characters with [[:graph:]]" do
+ "\u{2060}".match(/[[:graph:]]/).should be_nil
end
-it "matches Unicode private-use characters with [[:graph:]]" do
- "\u{E001}".match(/[[:graph:]]/).to_a.should == ["\u{E001}"]
+it "doesn't match Unicode private-use characters with [[:graph:]]" do
+ "\u{E001}".match(/[[:graph:]]/).should be_nil
end
-
it "matches Unicode lowercase letter characters with [[:lower:]]" do
"\u{FF41}".match(/[[:lower:]]/).to_a.should == ["\u{FF41}"]
"\u{1D484}".match(/[[:lower:]]/).to_a.should == ["\u{1D484}"]
@@ -248,12 +247,12 @@
"\u{16}".match(/[[:print:]]/).should be_nil
end
-it "matches Unicode format characters with [[:print:]]" do
- "\u{2060}".match(/[[:print:]]/).to_a.should == ["\u{2060}"]
+it "doesn't match Unicode format characters with [[:print:]]" do
+ "\u{2060}".match(/[[:print:]]/).should be_nil
end
-it "matches Unicode private-use characters with [[:print:]]" do
- "\u{E001}".match(/[[:print:]]/).to_a.should == ["\u{E001}"]
+it "doesn't match Unicode private-use characters with [[:print:]]" do
+ "\u{E001}".match(/[[:print:]]/).should be_nil
end
@@ -473,18 +472,17 @@
"\u{096C}".match(/[[:word:]]/).to_a.should == ["\u{096C}"]
end
-it "matches Unicode Nl characters with [[:word:]]" do
- "\u{16EE}".match(/[[:word:]]/).to_a.should == ["\u{16EE}"]
+it "matches Unicode marks with [[:word:]]" do
+ "\u{36F}".match(/[[:word:]]/).to_a.should == ["\u{36F}"]
end
-it "matches Unicode No characters with [[:word:]]" do
- "\u{17F0}".match(/[[:word:]]/).to_a.should == ["\u{17F0}"]
+it "doesn't match Unicode Nl characters with [[:word:]]" do
+ "\u{16EE}".match(/[[:word:]]/).should be_nil
end
-it "matches Unicode marks with [[:word:]]" do
- "\u{36F}".match(/[[:word:]]/).to_a.should == ["\u{36F}"]
+it "doesn't match Unicode No characters with [[:word:]]" do
+ "\u{17F0}".match(/[[:word:]]/).should be_nil
end
-
it "doesn't match Unicode punctuation characters with [[:word:]]" do
"\u{3F}".match(/[[:word:]]/).should be_nil
end
Modified: MacRuby/trunk/spec/frozen/language/return_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/return_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/return_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -118,61 +118,88 @@
end
describe "within a begin" do
- it "executes ensure before returning from function" do
- def f(a)
+ before :each do
+ ScratchPad.record []
+ end
+
+ it "executes ensure before returning" do
+ def f()
begin
- return a
+ ScratchPad << :begin
+ return :begin
+ ScratchPad << :after_begin
ensure
- a << 1
+ ScratchPad << :ensure
end
+ ScratchPad << :function
end
- f([]).should == [1]
+ f().should == :begin
+ ScratchPad.recorded.should == [:begin, :ensure]
end
- it "executes return in ensure before returning from function" do
- def f(a)
+ it "returns last value returned in ensure" do
+ def f()
begin
- return a
+ ScratchPad << :begin
+ return :begin
+ ScratchPad << :after_begin
ensure
- return [0]
- a << 1
+ ScratchPad << :ensure
+ return :ensure
+ ScratchPad << :after_ensure
end
+ ScratchPad << :function
end
- f([]).should == [0]
+ f().should == :ensure
+ ScratchPad.recorded.should == [:begin, :ensure]
end
- it "executes ensures in stack order before returning from function" do
- def f(a)
+ it "executes nested ensures before returning" do
+ def f()
begin
begin
- return a
+ ScratchPad << :inner_begin
+ return :inner_begin
+ ScratchPad << :after_inner_begin
ensure
- a << 2
+ ScratchPad << :inner_ensure
end
+ ScratchPad << :outer_begin
+ return :outer_begin
+ ScratchPad << :after_outer_begin
ensure
- a << 1
+ ScratchPad << :outer_ensure
end
+ ScratchPad << :function
end
- f([]).should == [2,1]
+ f().should == :inner_begin
+ ScratchPad.recorded.should == [:inner_begin, :inner_ensure, :outer_ensure]
end
- it "executes return at base of ensure stack" do
- def f(a)
+ it "returns last value returned in nested ensures" do
+ def f()
begin
begin
- return a
+ ScratchPad << :inner_begin
+ return :inner_begin
+ ScratchPad << :after_inner_begin
ensure
- a << 2
- return 2
+ ScratchPad << :inner_ensure
+ return :inner_ensure
+ ScratchPad << :after_inner_ensure
end
+ ScratchPad << :outer_begin
+ return :outer_begin
+ ScratchPad << :after_outer_begin
ensure
- a << 1
- return 1
+ ScratchPad << :outer_ensure
+ return :outer_ensure
+ ScratchPad << :after_outer_ensure
end
+ ScratchPad << :function
end
- a = []
- f(a).should == 1
- a.should == [2, 1]
+ f().should == :outer_ensure
+ ScratchPad.recorded.should == [:inner_begin, :inner_ensure, :outer_ensure]
end
end
Modified: MacRuby/trunk/spec/frozen/language/undef_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/undef_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/language/undef_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -6,9 +6,9 @@
describe "The undef keyword" do
it "undefines 'meth='" do
- obj = UndefSpecClass.new
+ obj = ::UndefSpecClass.new
(obj.meth 5).should == 5
- class UndefSpecClass
+ class ::UndefSpecClass
undef meth
end
lambda { obj.meth 5 }.should raise_error(NoMethodError)
Modified: MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/bigdecimal/new_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -18,10 +18,17 @@
end
ruby_bug "1589", "1.8.6.368" do
- it "doesn't segfault when using a very large string to build the number" do
- b = BigDecimal.new("1" + "0"*10000000)
- b._dump.should == "#{b.precs[1]}:0.1E10000001"
+ platform_is :wordsize => 32 do
+ it "doesn't segfault when using a very large string to build the number" do
+ BigDecimal.new("1" + "0"*10000000)._dump.should == "10000008:0.1E10000001"
+ end
end
+
+ platform_is :wordsize => 64 do
+ it "doesn't segfault when using a very large string to build the number" do
+ BigDecimal.new("1" + "0"*10000000)._dump.should == "10000017:0.1E10000001"
+ end
+ end
end
it "Number of significant digits >= given precision" do
Modified: MacRuby/trunk/spec/frozen/library/cgi/cookie/value_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/cgi/cookie/value_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/cgi/cookie/value_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -15,6 +15,30 @@
cookie = CGI::Cookie.new("name" => "test-cookie", "value" => ["one", "two", "three"])
cookie.value.should == ["one", "two", "three"]
end
+
+ ruby_bug "http://redmine.ruby-lang.org/issues/show/229", "1.8.7" do
+ it "is in synch with self" do
+ fail = []
+ [
+ :pop,
+ :shift,
+ [:<<, "Hello"],
+ [:push, "Hello"],
+ [:unshift, "World"],
+ [:replace, ["A", "B"]],
+ [:[]=, 1, "Set"],
+ [:delete, "first"],
+ [:delete_at, 0],
+ ].each do |method, *args|
+ cookie1 = CGI::Cookie.new("test-cookie", "first", "second")
+ cookie2 = CGI::Cookie.new("test-cookie", "first", "second")
+ cookie1.send(method, *args)
+ cookie2.value.send(method, *args)
+ fail << method unless cookie1.value == cookie2.value
+ end
+ fail.should be_empty
+ end
+ end
end
describe "CGI::Cookie#value=" do
Added: MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/library/mathn/bignum/exponent_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'mathn'
+
+describe "Bignum#**" do
+ before(:each) do
+ @bignum = bignum_value(47)
+ end
+
+ it "returns self raised to other (positive) power" do
+ (@bignum ** 4).should == 7237005577332262361485077344629993318496048279512298547155833600056910050625
+ (@bignum ** 1.2).should be_close(57262152889751597425762.57804, TOLERANCE)
+ end
+
+ it "returns a complex number when negative and raised to a fractional power" do
+ ((- at bignum) ** (1/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+ ((- at bignum) ** (1.0/3)).should be_close(Complex(1048576,1816186.907597341), TOLERANCE)
+ end
+end
Added: MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/library/mathn/fixnum/exponent_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'mathn'
+
+describe "Fixnum#**" do
+ it "returns self raised to other (positive) power" do
+ (2 ** 4).should == 16
+ (2 ** 1.2).should be_close(2.2973967, TOLERANCE)
+ end
+
+ it "returns a complex number when negative and raised to a fractional power" do
+ ((-8) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+ ((-8) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+ end
+end
Added: MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/library/mathn/float/exponent_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require 'mathn'
+
+describe "Float#**" do
+ it "returns self raised to other (positive) power" do
+ (2.0 ** 4).should == 16.0
+ (2.0 ** 1.2).should be_close(2.2973967, TOLERANCE)
+ end
+
+ it "returns a complex number when negative and raised to a fractional power" do
+ ((-8.0) ** (1/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+ ((-8.0) ** (1.0/3)).should be_close(Complex(1, 1.73205), TOLERANCE)
+ end
+end
Modified: MacRuby/trunk/spec/frozen/library/matrix/coerce_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/coerce_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/coerce_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -3,4 +3,10 @@
describe "Matrix#coerce" do
it "needs to be reviewed for spec completeness"
+
+ ruby_bug "revision 24952", "1.8.7" do
+ it "allows the division of fixnum by a Matrix " do
+ (1/Matrix[[0,1],[-1,0]]).should == Matrix[[0,-1],[1,0]]
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/library/matrix/divide_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/divide_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/divide_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -32,7 +32,7 @@
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a / Matrix[ 1 ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ lambda { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "returns an instance of Matrix" do
Modified: MacRuby/trunk/spec/frozen/library/matrix/minus_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/minus_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/minus_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -16,7 +16,7 @@
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a - Matrix[ 1 ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ lambda { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
Modified: MacRuby/trunk/spec/frozen/library/matrix/multiply_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/multiply_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/multiply_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -31,6 +31,6 @@
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a * Matrix[ 1 ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ lambda { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
end
Modified: MacRuby/trunk/spec/frozen/library/matrix/plus_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/plus_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/plus_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -16,7 +16,7 @@
end
it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do
- lambda { @a + Matrix[ 1 ] }.should raise_error(Matrix::ErrDimensionMismatch)
+ lambda { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch)
end
it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do
Modified: MacRuby/trunk/spec/frozen/library/matrix/rank_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/rank_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/rank_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -16,4 +16,10 @@
end
end
+ ruby_bug "revision 24969", "1.8.7" do
+ it "works for some easy rectangular matrices" do
+ Matrix[[0,0],[0,0],[1,0]].rank.should == 1
+ Matrix[[0,1],[0,0],[1,0]].rank.should == 2
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/library/matrix/row_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/row_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/row_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -10,6 +10,7 @@
Matrix[ *@data ].row(0).should == Vector[1,2]
end
+ # Seems like a bad idea...
it "returns an Array when called with a block" do
Matrix[ *@data ].row(0) { |x| x }.should == [1, 2]
end
Modified: MacRuby/trunk/spec/frozen/library/matrix/shared/determinant.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/matrix/shared/determinant.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/matrix/shared/determinant.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -11,7 +11,7 @@
ruby_bug "#1516", "1.8.7" do
it "returns the determinant of a square Matrix" do
m = Matrix[ [7,6], [3,9] ]
- m.send(@method).should == 45
+ m.send(@method).should == 45
m = Matrix[ [9, 8], [6,5] ]
m.send(@method).should == -3
@@ -19,9 +19,9 @@
m = Matrix[ [9,8,3], [4,20,5], [1,1,1] ]
m.send(@method).should == 95
end
- end
-
- it "returns the determinant of a single-element Matrix" do
+ end
+
+ it "returns the determinant of a single-element Matrix" do
m = Matrix[ [2] ]
m.send(@method).should == 2
end
@@ -33,14 +33,20 @@
# Matrix#square? returns true if the first row of the matrix has the same
# number of columns as the matrix has rows. This causes the .determinant
- # method to raise a NoMethodError for '-'. I've reported it as
+ # method to raise a NoMethodError for '-'. I've reported it as
# http://redmine.ruby-lang.org/issues/show/1515 , and will guard for this bug
- # in the #square? test. The examples below deliberately avoid this condition.
- it "returns 0 when the Matrix is not square" do
- m = Matrix[ [1], [2,3] ]
+ # in the #square? test. The examples below deliberately avoid this condition.
+ it "returns 0 when the Matrix is not square" do
+ m = Matrix[ [1], [2,3] ]
m.send(@method).should == 0
m = Matrix[ [1,2,3], [4,2] ]
m.send(@method).should == 0
- end
+ end
+
+ ruby_bug "#1531", "1.9.1" do
+ it "returns the determinant of a Matrices containing 0 as first entry" do
+ Matrix[[0,1],[1,0]].send(@method).should == -1
+ end
+ end
end
Modified: MacRuby/trunk/spec/frozen/library/net/http/httpgenericrequest/exec_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/net/http/httpgenericrequest/exec_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/net/http/httpgenericrequest/exec_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -2,21 +2,31 @@
require 'net/http'
require "stringio"
-describe "Net::HTTPGenericRequest#exec wehn passed socket, version, path" do
- it "executes the request over the passed socket to the passed path using the passed HTTP version" do
+describe "Net::HTTPGenericRequest#exec when passed socket, version, path" do
+ it "executes the request over the socket to the path using the HTTP version" do
request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path")
socket = StringIO.new("")
-
+
request.exec(socket, "1.1", "/some/path")
- socket.string.should == "POST /some/path HTTP/1.1\r\nAccept: */*\r\n\r\n"
+ str = socket.string
- request = Net::HTTPGenericRequest.new("GET", true, true, "/some/path", "Content-Type" => "text/html")
+ str.should =~ %r[POST /some/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str[-4..-1].should == "\r\n\r\n"
+
+ request = Net::HTTPGenericRequest.new("GET", true, true, "/some/path",
+ "Content-Type" => "text/html")
socket = StringIO.new("")
request.exec(socket, "1.0", "/some/other/path")
- socket.string.should == "GET /some/other/path HTTP/1.0\r\nAccept: */*\r\nContent-Type: text/html\r\n\r\n"
+ str = socket.string
+
+ str.should =~ %r[GET /some/other/path HTTP/1.0\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: text/html\r\n]
+ str[-4..-1].should == "\r\n\r\n"
end
-
+
describe "when a request body is set" do
it "sets the 'Content-Type' header to 'application/x-www-form-urlencoded' unless the 'Content-Type' header is supplied" do
request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path")
@@ -24,49 +34,86 @@
socket = StringIO.new("")
request.exec(socket, "1.1", "/some/other/path")
- socket.string.should == "POST /some/other/path HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 12\r\n\r\nSome Content"
+ str = socket.string
+
+ str.should =~ %r[POST /some/other/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: application/x-www-form-urlencoded\r\n]
+ str.should =~ %r[Content-Length: 12\r\n]
+ str[-16..-1].should == "\r\n\r\nSome Content"
end
it "correctly sets the 'Content-Length' header and includes the body" do
- request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path", "Content-Type" => "text/html")
+ request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path",
+ "Content-Type" => "text/html")
request.body = "Some Content"
socket = StringIO.new("")
request.exec(socket, "1.1", "/some/other/path")
- socket.string.should == "POST /some/other/path HTTP/1.1\r\nAccept: */*\r\nContent-Type: text/html\r\nContent-Length: 12\r\n\r\nSome Content"
+ str = socket.string
+
+ str.should =~ %r[POST /some/other/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: text/html\r\n]
+ str.should =~ %r[Content-Length: 12\r\n]
+ str[-16..-1].should == "\r\n\r\nSome Content"
end
end
-
+
describe "when a body stream is set" do
it "sets the 'Content-Type' header to 'application/x-www-form-urlencoded' unless the 'Content-Type' header is supplied" do
- request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path", "Content-Length" => "10")
+ request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path",
+ "Content-Length" => "10")
request.body_stream = StringIO.new("a" * 20)
socket = StringIO.new("")
request.exec(socket, "1.1", "/some/other/path")
- socket.string.should == "POST /some/other/path HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 10\r\n\r\naaaaaaaaaaaaaaaaaaaa"
+ str = socket.string
+
+ str.should =~ %r[POST /some/other/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: application/x-www-form-urlencoded\r\n]
+ str.should =~ %r[Content-Length: 10\r\n]
+ str[-24..-1].should == "\r\n\r\naaaaaaaaaaaaaaaaaaaa"
end
it "sends the whole stream, regardless of the 'Content-Length' header" do
- request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path", "Content-Type" => "text/html", "Content-Length" => "10")
+ request = Net::HTTPGenericRequest.new("POST", true, true,"/some/path",
+ "Content-Type" => "text/html",
+ "Content-Length" => "10")
request.body_stream = StringIO.new("a" * 20)
socket = StringIO.new("")
request.exec(socket, "1.1", "/some/other/path")
- socket.string.should == "POST /some/other/path HTTP/1.1\r\nAccept: */*\r\nContent-Type: text/html\r\nContent-Length: 10\r\n\r\naaaaaaaaaaaaaaaaaaaa"
+ str = socket.string
+
+ str.should =~ %r[POST /some/other/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: text/html\r\n]
+ str.should =~ %r[Content-Length: 10\r\n]
+ str[-24..-1].should == "\r\n\r\naaaaaaaaaaaaaaaaaaaa"
end
-
+
it "sends the request in chunks of 1024 bytes when 'Transfer-Encoding' is set to 'chunked'" do
- request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path", "Content-Type" => "text/html", "Transfer-Encoding" => "chunked")
+ request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path",
+ "Content-Type" => "text/html",
+ "Transfer-Encoding" => "chunked")
request.body_stream = StringIO.new("a" * 1024 * 2)
socket = StringIO.new("")
request.exec(socket, "1.1", "/some/other/path")
- socket.string.should == "POST /some/other/path HTTP/1.1\r\nAccept: */*\r\nContent-Type: text/html\r\nTransfer-Encoding: chunked\r\n\r\n400\r\n#{'a' * 1024}\r\n400\r\n#{'a' * 1024}\r\n0\r\n\r\n"
+ str = socket.string
+
+ str.should =~ %r[POST /some/other/path HTTP/1.1\r\n]
+ str.should =~ %r[Accept: \*/\*\r\n]
+ str.should =~ %r[Content-Type: text/html\r\n]
+ str.should =~ %r[Transfer-Encoding: chunked\r\n\r\n]
+ str.should =~ %r[400\r\n#{'a' * 1024}\r\n400\r\n#{'a' * 1024}\r\n0\r\n\r\n$]
end
it "raises an ArgumentError when the 'Content-Length' is not set or 'Transfer-Encoding' is not set to 'chunked'" do
- request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path", "Content-Type" => "text/html")
+ request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path",
+ "Content-Type" => "text/html")
request.body_stream = StringIO.new("Some Content")
socket = StringIO.new("")
Added: MacRuby/trunk/spec/frozen/library/openssl/config/freeze_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/openssl/config/freeze_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/library/openssl/config/freeze_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+require File.dirname(__FILE__) + '/../shared/constants'
+
+require 'openssl'
+
+describe "OpenSSL::Config#freeze" do
+ it "needs to be reviewed for completeness"
+
+ ruby_bug "redmine:484", "1.8.7" do
+ it "freezes" do
+ c = OpenSSL::Config.new
+ lambda{c['foo'] = [ ['key', 'value'] ]}.should_not raise_error
+ c.freeze
+ c.frozen?.should be_true
+ lambda{c['foo'] = [ ['key', 'value'] ]}.should raise_error
+ end
+ end
+end
Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_read_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_read_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_read_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -25,5 +25,19 @@
@server.close_read
@server.closed?.should be_false
end
+
+ it "fully closes the socket if it was already closed for writing" do
+ @server.close_write
+ @server.close_read
+ @server.closed?.should be_true
+ end
+
+ it "raises IOError on closed socket" do
+ @server.close
+ lambda { @server.close_read }.should raise_error(IOError)
+ end
+
+ it "returns nil" do
+ @server.close_read.should be_nil
+ end
end
-
Modified: MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_write_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_write_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/socket/basicsocket/close_write_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -25,4 +25,19 @@
@server.close_write
@server.closed?.should be_false
end
+
+ it "fully closes the socket if it was already closed for reading" do
+ @server.close_read
+ @server.close_write
+ @server.closed?.should be_true
+ end
+
+ it "raises IOError on closed socket" do
+ @server.close
+ lambda { @server.close_write }.should raise_error(IOError)
+ end
+
+ it "returns nil" do
+ @server.close_write.should be_nil
+ end
end
Modified: MacRuby/trunk/spec/frozen/library/socket/ipsocket/getaddress_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/ipsocket/getaddress_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/socket/ipsocket/getaddress_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -14,7 +14,7 @@
end
it "raises an error on unknown hostnames" do
- lambda { IPSocket.getaddress("foobard.") }.should raise_error(SocketError)
+ lambda { IPSocket.getaddress("imfakeidontexistanditrynottobeslow.com") }.should raise_error(SocketError)
end
end
Modified: MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/socket/socket/for_fd_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -4,27 +4,34 @@
describe "Socket#for_fd given a file descriptor" do
it "adopts that descriptor into a new Socket object" do
- server = TCPServer.new("0.0.0.0", SocketSpecs.port)
- client = TCPSocket.open("0.0.0.0", SocketSpecs.port)
+ begin
+ server = TCPServer.new("0.0.0.0", SocketSpecs.port)
+ client = TCPSocket.open("0.0.0.0", SocketSpecs.port)
+ new_sock = Socket.for_fd(client.fileno)
- new_sock = Socket.for_fd(client.fileno)
-
- # TODO: RSpec uses #send internally when calling #should == something
- # but as Socket#send does not do what RSpex expects it to do,
- # it fails horriby. RSpec should be using #__send__
- new_sock.should_not be_nil
- new_sock.class.should == Socket
- new_sock.fileno.should == client.fileno
+ # TODO: RSpec uses #send internally when calling #should == something
+ # but as Socket#send does not do what RSpex expects it to do,
+ # it fails horriby. RSpec should be using #__send__
+ new_sock.should_not be_nil
+ new_sock.class.should == Socket
+ new_sock.fileno.should == client.fileno
- new_sock.write("foo")
- client.write("bar")
- host = server.accept
- host.read(3).should == "foo"
- host.read(3).should == "bar"
-
- server.close unless server.closed?
- client.close unless server.closed?
- new_sock.close unless new_sock.closed?
+ new_sock.write("foo")
+ client.write("bar")
+ host = server.accept
+ host.read(3).should == "foo"
+ host.read(3).should == "bar"
+ ensure
+ if (server && !server.closed?)
+ server.close unless server.closed?
+ end
+ if (client && !client.closed?)
+ client.close unless server.closed?
+ end
+ if (new_sock && !new_sock.closed?)
+ new_sock.close
+ end
+ end
end
it "raises error for a bad descriptor" do
Modified: MacRuby/trunk/spec/frozen/library/socket/socket/getnameinfo_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/socket/socket/getnameinfo_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/socket/socket/getnameinfo_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,2 +1,34 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../fixtures/classes'
+
+require 'socket'
+
+describe "Socket#getnameinfo" do
+ before :all do
+ @reverse_lookup = BasicSocket.do_not_reverse_lookup
+ BasicSocket.do_not_reverse_lookup = true
+ end
+
+ after :all do
+ BasicSocket.do_not_reverse_lookup = @reverse_lookup
+ end
+
+ it "gets the name information and don't resolve it" do
+ sockaddr = Socket.sockaddr_in SocketSpecs.port, '127.0.0.1'
+ name_info = Socket.getnameinfo(sockaddr, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV)
+ name_info.should == ['127.0.0.1', "#{SocketSpecs.port}"]
+ end
+
+ it "gets the name information and resolve the host" do
+ sockaddr = Socket.sockaddr_in SocketSpecs.port, '127.0.0.1'
+ name_info = Socket.getnameinfo(sockaddr, Socket::NI_NUMERICSERV)
+ name_info.should == ['localhost', "#{SocketSpecs.port}"]
+ end
+
+ it "gets the name information and resolves the service" do
+ sockaddr = Socket.sockaddr_in 80, '127.0.0.1'
+ name_info = Socket.getnameinfo(sockaddr)
+ name_info.should == ["localhost", "http"]
+ end
+end
+
Modified: MacRuby/trunk/spec/frozen/library/tempfile/open_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/library/tempfile/open_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/library/tempfile/open_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -55,9 +55,11 @@
end
ruby_version_is '1.8.7' .. '1.9' do
- describe "Tempfile.open is passed an array [base,suffix] as first argument" do
- tempfile = nil
- Tempfile.open(["specs", ".tt"]) { |x| tempfile = x }
- tempfile.path.should =~ /specs.*\.tt$/
+ describe "Tempfile.open" do
+ it "is passed an array [base,suffix] as first argument" do
+ tempfile = nil
+ Tempfile.open(["specs", ".tt"]) { |x| tempfile = x }
+ tempfile.path.should =~ /specs.*\.tt$/
+ end
end
end
Modified: MacRuby/trunk/spec/frozen/optional/ffi/pointer_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/optional/ffi/pointer_spec.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/optional/ffi/pointer_spec.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -138,21 +138,21 @@
end
describe "AutoPointer#new" do
- it "MemoryPointer argument raises ArgumentError" do
+ it "MemoryPointer argument raises TypeError" do
lambda {
FFI::AutoPointer.new(FFI::MemoryPointer.new(:int))
- }.should raise_error(ArgumentError)
+ }.should raise_error(TypeError)
end
- it "AutoPointer argument raises ArgumentError" do
+ it "AutoPointer argument raises TypeError" do
lambda {
FFI::AutoPointer.new(FFI::AutoPointer.new(FFISpecs::LibTest.ptr_from_address(0)))
- }.should raise_error(ArgumentError)
+ }.should raise_error(TypeError)
end
- it "Buffer argument raises ArgumentError" do
+ it "Buffer argument raises TypeError" do
lambda {
FFI::AutoPointer.new(FFI::Buffer.new(:int))
- }.should raise_error(ArgumentError)
+ }.should raise_error(TypeError)
end
end
\ No newline at end of file
Added: MacRuby/trunk/spec/frozen/shared/enumerator/with_object.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/enumerator/with_object.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/shared/enumerator/with_object.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe :enum_with_object, :shared => true do
+ it "returns an enumerator when not given a block" do
+ [].to_enum.send(@method, '').should be_an_instance_of(Enumerator)
+ end
+
+ it "returns the given object when given a block" do
+ object = [].to_enum.send(@method, 'wadus') {|i, o| o = o + o}
+ object.should == 'wadus'
+ end
+
+ it "iterates over the array adding the given object" do
+ expected = ''
+ %w|wadus wadus|.each.send(@method, ' ') {|e, o| expected += e + o}
+
+ expected.should == 'wadus wadus '
+ end
+end
\ No newline at end of file
Modified: MacRuby/trunk/spec/frozen/shared/file/size.rb
===================================================================
--- MacRuby/trunk/spec/frozen/shared/file/size.rb 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/shared/file/size.rb 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,26 +1,24 @@
describe :file_size, :shared => true do
before :each do
- @empty = "i_am_empty"
- File.delete @empty if File.exist? @empty
- File.open(@empty,'w') { }
-
@exists = tmp('i_exist')
File.open(@exists,'w') { |f| f.write 'rubinius' }
end
after :each do
- File.delete @empty if File.exist? @empty
File.delete @exists if File.exist? @exists
end
- it "returns nil if the file has zero size" do
- @object.send(@method, @empty).should == nil
- end
-
it "returns the size of the file if it exists and is not empty" do
@object.send(@method, @exists).should == 8
end
+ it "accepts a String-like (to_str) parameter" do
+ o = [@exists]
+ def o.to_str; self[0]; end
+
+ @object.send(@method, o).should == 8
+ end
+
ruby_version_is "1.9" do
it "accepts an object that has a #to_path method" do
@object.send(@method, mock_to_path(@exists)).should == 8
@@ -28,13 +26,71 @@
end
end
-describe :file_size_missing, :shared => true do
+describe :file_size_raise_when_missing, :shared => true do
before :each do
@missing = "i_dont_exist"
File.delete @missing if File.exists? @missing
end
- it "returns nil if file_name doesn't exist" do
- @object.send(@method, @missing).should == nil
+ it "raises an error if file_name doesn't exist" do
+ lambda {@object.send(@method, @missing)}.should raise_error(Errno::ENOENT)
end
end
+
+describe :file_size_nil_when_missing, :shared => true do
+ before :each do
+ @missing = "i_dont_exist"
+ File.delete @missing if File.exists? @missing
+ end
+
+ it "returns nil if file_name doesn't exist or has 0 size" do
+ @object.send(@method, @missing).should == nil
+ end
+end
+
+describe :file_size_0_when_empty, :shared => true do
+ before :each do
+ @empty = "i_am_empty"
+ File.delete @empty if File.exist? @empty
+ File.open(@empty,'w') { }
+ end
+
+ after :each do
+ File.delete @empty if File.exist? @empty
+ end
+
+ it "returns 0 if the file is empty" do
+ @object.send(@method, @empty).should == 0
+ end
+end
+
+describe :file_size_nil_when_empty, :shared => true do
+ before :each do
+ @empty = "i_am_empty"
+ File.delete @empty if File.exist? @empty
+ File.open(@empty,'w') { }
+ end
+
+ after :each do
+ File.delete @empty if File.exist? @empty
+ end
+
+ it "returns nil if file_name is empty" do
+ @object.send(@method, @empty).should == nil
+ end
+end
+
+describe :file_size_with_file_argument, :shared => true do
+ before :each do
+ @exists = tmp('i_exist')
+ File.open(@exists,'w') { |f| f.write 'rubinius' }
+ end
+
+ after :each do
+ File.delete @exists if File.exist? @exists
+ end
+
+ it "accepts a File argument" do
+ @object.send(@method,File.open(@exists)).should == 8
+ end
+end
\ No newline at end of file
Deleted: MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/rank_tags.txt.orig
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/rank_tags.txt.orig 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/rank_tags.txt.orig 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,5 +0,0 @@
-<<<<<<< HEAD
-fails:Matrix#rank doesn't loop forever
-=======
-critical:Matrix#rank doesn't loop forever
->>>>>>> fixed .gitignore and added all the tags that were missing yesterday.
Deleted: MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/regular_tags.txt.orig
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/regular_tags.txt.orig 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/tags/macruby/library/matrix/regular_tags.txt.orig 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1,8 +0,0 @@
-<<<<<<< HEAD
-fails:Matrix#regular? returns false unless rank(A) != n
-fails:Matrix#regular? returns false if the determinant is 0
-fails:Matrix#regular? returns true if the Matrix is regular
-=======
-critical:Matrix#regular? returns false unless rank(A) != n
-fails:Matrix#regular? returns false if the determinant is 0
->>>>>>> fixed .gitignore and added all the tags that were missing yesterday.
Modified: MacRuby/trunk/spec/frozen/upstream
===================================================================
--- MacRuby/trunk/spec/frozen/upstream 2009-10-04 21:44:14 UTC (rev 2712)
+++ MacRuby/trunk/spec/frozen/upstream 2009-10-04 21:45:47 UTC (rev 2713)
@@ -1 +1 @@
-eaa3a371fabfcf84f8e04f98c3c53f3eff90f1c8
\ 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/20091004/b6f8648d/attachment-0001.html>
More information about the macruby-changes
mailing list