[macruby-changes] [1962] MacRuby/branches/experimental/spec
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 1 16:47:25 PDT 2009
Revision: 1962
http://trac.macosforge.org/projects/ruby/changeset/1962
Author: eloy.de.enige at gmail.com
Date: 2009-07-01 16:47:24 -0700 (Wed, 01 Jul 2009)
Log Message:
-----------
Tagged critical specs.
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/argf/close_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/objectspace/define_finalizer_tags.txt
MacRuby/branches/experimental/spec/macruby.mspec
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/exception/equal_value_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/force_encoding_tags.txt
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec.rb
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb 2009-07-01 23:47:24 UTC (rev 1962)
@@ -1,63 +0,0 @@
-# coding: utf-8
-require File.dirname(__FILE__) + '/../../spec_helper'
-
-ruby_version_is "1.9" do
- describe "String#getbyte" do
- it "returns an Integer if given a valid index" do
- "a".getbyte(0).should be_kind_of(Integer)
- end
-
- it "starts indexing at 0" do
- "b".getbyte(0).should == 98
- end
-
- it "counts from the end of the String if given a negative argument" do
- "glark".getbyte(-1).should == "glark".getbyte(4)
- end
-
- it "returns an Integer between 0 and 255" do
- "\x00".getbyte(0).should == 0
- "\xFF".getbyte(0).should == 255
- 256.chr('utf-8').getbyte(0).should == 196
- 256.chr('utf-8').getbyte(1).should == 128
- end
-
- it "regards a multi-byte character as having multiple bytes" do
- chr = "\u{998}"
- chr.bytesize.should == 3
- chr.getbyte(0).should == 224
- chr.getbyte(1).should == 166
- chr.getbyte(2).should == 152
- end
-
- it "mirrors the output of #bytes" do
- str = "UTF-8 (\u{9865}} characters and hex escapes (\xDE)"
- str.bytes.to_a.each_with_index do |byte, index|
- str.getbyte(index).should == byte
- end
- end
-
- it "interprets bytes relative to the String's encoding" do
- str = "\u{333}"
- str.encode('utf-8').getbyte(0).should_not == \
- str.encode('utf-16le').getbyte(0)
- end
-
- it "returns nil for out-of-bound indexes" do
- "g".getbyte(1).should be_nil
- end
-
- it "regards the empty String as containing no bytes" do
- "".getbyte(0).should be_nil
- end
-
- it "raises an ArgumentError unless given one argument" do
- lambda { "glark".getbyte }.should raise_error(ArgumentError)
- lambda { "food".getbyte(0,0) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError unless its argument can be coerced into an Integer" do
- lambda { "a".getbyte('a') }.should raise_error(TypeError)
- end
- end
-end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb 2009-07-01 23:47:24 UTC (rev 1962)
@@ -1,37 +1,63 @@
-# coding: UTF-8
+# coding: utf-8
+require File.dirname(__FILE__) + '/../../spec_helper'
+
ruby_version_is "1.9" do
describe "String#getbyte" do
- it "returns the same value whatever the encoding, even if valid_encoding? is false" do
- str = 'こんにちは'
- ['ASCII-8BIT', 'EUC-JP'].each do |encoding|
- str2 = str.dup
- str2.force_encoding(encoding)
- (1...str.bytesize).each do |i|
- str2.getbyte(i).should == str.getbyte(i)
- end
+ it "returns an Integer if given a valid index" do
+ "a".getbyte(0).should be_kind_of(Integer)
+ end
+
+ it "starts indexing at 0" do
+ "b".getbyte(0).should == 98
+ end
+
+ it "counts from the end of the String if given a negative argument" do
+ "glark".getbyte(-1).should == "glark".getbyte(4)
+ end
+
+ it "returns an Integer between 0 and 255" do
+ "\x00".getbyte(0).should == 0
+ "\xFF".getbyte(0).should == 255
+ 256.chr('utf-8').getbyte(0).should == 196
+ 256.chr('utf-8').getbyte(1).should == 128
+ end
+
+ it "regards a multi-byte character as having multiple bytes" do
+ chr = "\u{998}"
+ chr.bytesize.should == 3
+ chr.getbyte(0).should == 224
+ chr.getbyte(1).should == 166
+ chr.getbyte(2).should == 152
+ end
+
+ it "mirrors the output of #bytes" do
+ str = "UTF-8 (\u{9865}} characters and hex escapes (\xDE)"
+ str.bytes.to_a.each_with_index do |byte, index|
+ str.getbyte(index).should == byte
end
end
- it "returns the (n+1)th byte from the start of a string if n >= 0" do
- str = "\xE3\x81\x82" # 'あ' in UTF-8
- str.getbyte(0).should == 0xE3
- str.getbyte(1).should == 0x81
- str.getbyte(2).should == 0x82
+ it "interprets bytes relative to the String's encoding" do
+ str = "\u{333}"
+ str.encode('utf-8').getbyte(0).should_not == \
+ str.encode('utf-16le').getbyte(0)
end
- it "returns the (-n)th byte from the end of a string if n < 0" do
- str = "\xE3\x81\x82" # 'あ' in UTF-8
- str.getbyte(-3).should == 0xE3
- str.getbyte(-2).should == 0x81
- str.getbyte(-1).should == 0x82
+ it "returns nil for out-of-bound indexes" do
+ "g".getbyte(1).should be_nil
end
- it "returns nil for an offset outside the string" do
- str = "abcdef"
- str.getbyte(6).should be_nil
- str.getbyte(100).should be_nil
- str.getbyte(-100).should be_nil
- str.getbyte(-7).should be_nil
+ it "regards the empty String as containing no bytes" do
+ "".getbyte(0).should be_nil
end
+
+ it "raises an ArgumentError unless given one argument" do
+ lambda { "glark".getbyte }.should raise_error(ArgumentError)
+ lambda { "food".getbyte(0,0) }.should raise_error(ArgumentError)
+ end
+
+ it "raises a TypeError unless its argument can be coerced into an Integer" do
+ lambda { "a".getbyte('a') }.should raise_error(TypeError)
+ end
end
end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec.rb 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec.rb 2009-07-01 23:47:24 UTC (rev 1962)
@@ -1,55 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-
-ruby_version_is "1.9" do
- describe "String#setbyte" do
- it "returns an Integer" do
- "a".setbyte(0,1).should be_kind_of(Integer)
- end
-
- it "modifies the receiver" do
- str = "glark"
- old_id = str.object_id
- str.setbyte(0,88)
- str.object_id.should == old_id
- end
-
- it "changes the byte at the given index to the new byte" do
- str = "a"
- str.setbyte(0,98)
- str.should == 'b'
- end
-
- it "allows changing bytes in multi-byte characters" do
- str = "\u{915}"
- str.setbyte(1,254)
- str.getbyte(1).should == 254
- end
-
- it "can invalidate a String's encoding" do
- str = "glark"
- str.valid_encoding?.should be_true
- str.setbyte(2,253)
- str.valid_encoding?.should be_false
- end
-
- it "regards a negative index as counting from the end of the String" do
- str = "hedgehog"
- str.setbyte(-3, 108)
- str.should == "hedgelog"
- end
-
- it "raises an IndexError unless the index is inside the String" do
- lambda { "?".setbyte(1,97) }.should raise_error(IndexError)
- end
-
- it "raises a RuntimeError if self is frozen" do
- str = "cold".freeze
- str.frozen?.should be_true
- lambda { str.setbyte(3,96) }.should raise_error(RuntimeError)
- end
-
- it "raises a TypeError unless the second argument is an Integer" do
- lambda { "a".setbyte(0,'a') }.should raise_error(TypeError)
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec_disabled.rb (from rev 1961, MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/setbyte_spec_disabled.rb 2009-07-01 23:47:24 UTC (rev 1962)
@@ -0,0 +1,55 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+ruby_version_is "1.9" do
+ describe "String#setbyte" do
+ it "returns an Integer" do
+ "a".setbyte(0,1).should be_kind_of(Integer)
+ end
+
+ it "modifies the receiver" do
+ str = "glark"
+ old_id = str.object_id
+ str.setbyte(0,88)
+ str.object_id.should == old_id
+ end
+
+ it "changes the byte at the given index to the new byte" do
+ str = "a"
+ str.setbyte(0,98)
+ str.should == 'b'
+ end
+
+ it "allows changing bytes in multi-byte characters" do
+ str = "\u{915}"
+ str.setbyte(1,254)
+ str.getbyte(1).should == 254
+ end
+
+ it "can invalidate a String's encoding" do
+ str = "glark"
+ str.valid_encoding?.should be_true
+ str.setbyte(2,253)
+ str.valid_encoding?.should be_false
+ end
+
+ it "regards a negative index as counting from the end of the String" do
+ str = "hedgehog"
+ str.setbyte(-3, 108)
+ str.should == "hedgelog"
+ end
+
+ it "raises an IndexError unless the index is inside the String" do
+ lambda { "?".setbyte(1,97) }.should raise_error(IndexError)
+ end
+
+ it "raises a RuntimeError if self is frozen" do
+ str = "cold".freeze
+ str.frozen?.should be_true
+ lambda { str.setbyte(3,96) }.should raise_error(RuntimeError)
+ end
+
+ it "raises a TypeError unless the second argument is an Integer" do
+ lambda { "a".setbyte(0,'a') }.should raise_error(TypeError)
+ end
+ end
+end
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/argf/close_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/argf/close_tags.txt 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/argf/close_tags.txt 2009-07-01 23:47:24 UTC (rev 1962)
@@ -1,2 +1,3 @@
fails:ARGF.close closes the current open stream
fails:ARGF.close raises an IOError if called on a closed stream
+critical:ARGF.close can close STDIN
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/exception/equal_value_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/exception/equal_value_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/exception/equal_value_tags.txt 2009-07-01 23:47:24 UTC (rev 1962)
@@ -0,0 +1 @@
+critical:Exception#== returns true if the two exceptions inherit from Exception but have different classes
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/objectspace/define_finalizer_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/objectspace/define_finalizer_tags.txt 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/objectspace/define_finalizer_tags.txt 2009-07-01 23:47:24 UTC (rev 1962)
@@ -1 +1,2 @@
critical:ObjectSpace.define_finalizer calls finalizer on process termination
+critical:ObjectSpace.define_finalizer doesn't call self-referencing finalizers
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/force_encoding_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/force_encoding_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/force_encoding_tags.txt 2009-07-01 23:47:24 UTC (rev 1962)
@@ -0,0 +1 @@
+critical:String#force_encoding does not transcode self
Modified: MacRuby/branches/experimental/spec/macruby.mspec
===================================================================
--- MacRuby/branches/experimental/spec/macruby.mspec 2009-07-01 23:47:00 UTC (rev 1961)
+++ MacRuby/branches/experimental/spec/macruby.mspec 2009-07-01 23:47:24 UTC (rev 1962)
@@ -14,6 +14,7 @@
'^core/kernel/callcc_spec.rb',
# Currently not working on MacRuby
+ '^core/encoding',
'^core/marshal',
'^core/numeric/to_c_spec.rb',
'^core/precision',
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090701/fc50c5d1/attachment-0001.html>
More information about the macruby-changes
mailing list