[macruby-changes] [1740] MacRuby/branches/experimental/spec/frozen/core/string
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 4 18:14:43 PDT 2009
Revision: 1740
http://trac.macosforge.org/projects/ruby/changeset/1740
Author: lsansonetti at apple.com
Date: 2009-06-04 18:14:43 -0700 (Thu, 04 Jun 2009)
Log Message:
-----------
re-enabling upcase spec (this one runs all green)
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb
Copied: MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb (from rev 1729, MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb 2009-06-05 01:14:43 UTC (rev 1740)
@@ -0,0 +1,60 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#upcase" do
+ it "returns a copy of self with all lowercase letters upcased" do
+ "Hello".upcase.should == "HELLO"
+ "hello".upcase.should == "HELLO"
+ end
+
+ it "is locale insensitive (only replaces a-z)" do
+ "äöü".upcase.should == "äöü"
+
+ str = Array.new(256) { |c| c.chr }.join
+ expected = Array.new(256) do |i|
+ c = i.chr
+ c.between?("a", "z") ? c.upcase : c
+ end.join
+
+ str.upcase.should == expected
+ end
+
+ it "taints result when self is tainted" do
+ "".taint.upcase.tainted?.should == true
+ "X".taint.upcase.tainted?.should == true
+ "x".taint.upcase.tainted?.should == true
+ end
+
+ it "returns a subclass instance for subclasses" do
+ StringSpecs::MyString.new("fooBAR").upcase.class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#upcase!" do
+ it "modifies self in place" do
+ a = "HeLlO"
+ a.upcase!.should equal(a)
+ a.should == "HELLO"
+ end
+
+ it "returns nil if no modifications were made" do
+ a = "HELLO"
+ a.upcase!.should == nil
+ a.should == "HELLO"
+ end
+
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError when self is frozen" do
+ lambda { "HeLlo".freeze.upcase! }.should raise_error(TypeError)
+ lambda { "HELLO".freeze.upcase! }.should raise_error(TypeError)
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError when self is frozen" do
+ lambda { "HeLlo".freeze.upcase! }.should raise_error(RuntimeError)
+ lambda { "HELLO".freeze.upcase! }.should raise_error(RuntimeError)
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb 2009-06-05 01:12:42 UTC (rev 1739)
+++ MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb 2009-06-05 01:14:43 UTC (rev 1740)
@@ -1,60 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#upcase" do
- it "returns a copy of self with all lowercase letters upcased" do
- "Hello".upcase.should == "HELLO"
- "hello".upcase.should == "HELLO"
- end
-
- it "is locale insensitive (only replaces a-z)" do
- "äöü".upcase.should == "äöü"
-
- str = Array.new(256) { |c| c.chr }.join
- expected = Array.new(256) do |i|
- c = i.chr
- c.between?("a", "z") ? c.upcase : c
- end.join
-
- str.upcase.should == expected
- end
-
- it "taints result when self is tainted" do
- "".taint.upcase.tainted?.should == true
- "X".taint.upcase.tainted?.should == true
- "x".taint.upcase.tainted?.should == true
- end
-
- it "returns a subclass instance for subclasses" do
- StringSpecs::MyString.new("fooBAR").upcase.class.should == StringSpecs::MyString
- end
-end
-
-describe "String#upcase!" do
- it "modifies self in place" do
- a = "HeLlO"
- a.upcase!.should equal(a)
- a.should == "HELLO"
- end
-
- it "returns nil if no modifications were made" do
- a = "HELLO"
- a.upcase!.should == nil
- a.should == "HELLO"
- end
-
- ruby_version_is ""..."1.9" do
- it "raises a TypeError when self is frozen" do
- lambda { "HeLlo".freeze.upcase! }.should raise_error(TypeError)
- lambda { "HELLO".freeze.upcase! }.should raise_error(TypeError)
- end
- end
-
- ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- lambda { "HeLlo".freeze.upcase! }.should raise_error(RuntimeError)
- lambda { "HELLO".freeze.upcase! }.should raise_error(RuntimeError)
- end
- end
-end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090604/686f7f72/attachment-0001.html>
More information about the macruby-changes
mailing list