Sha256: 3dce32621b99c76cbd8db6c9498dc03fbb1924dee8041611a7511a0d66f51079

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

describe "String#swapcase" do
  it "returns a new string with all uppercase chars from self converted to lowercase and vice versa" do
    "Hello".swapcase.should == "hELLO"
    "cYbEr_PuNk11".swapcase.should == "CyBeR_pUnK11"
    "+++---111222???".swapcase.should == "+++---111222???"
  end

  it "is locale insensitive (only upcases a-z and only downcases A-Z" do
    "ÄÖÜ".swapcase.should == "ÄÖÜ"
    "ärger".swapcase.should == "äRGER"
    "BÄR".swapcase.should == "bÄr"
  end

  it "returns subclass instances when called on a subclass" do
    StringSpecs::MyString.new("").swapcase.should be_kind_of(StringSpecs::MyString)
    StringSpecs::MyString.new("hello").swapcase.should be_kind_of(StringSpecs::MyString)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-0.3.22 spec/core/string/swapcase_spec.rb
opal-0.3.21 test/core/string/swapcase_spec.rb
opal-0.3.20 test/core/string/swapcase_spec.rb
opal-0.3.19 test/core/string/swapcase_spec.rb