Sha256: e5924088d43e36a1d22dccc760f5de9f39dce104685153bcb16bed19d9f63cc3

Contents?: true

Size: 1.22 KB

Versions: 83

Compression:

Stored size: 1.22 KB

Contents

# -*- encoding: utf-8 -*-
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes.rb'

ruby_version_is "1.9" do
  describe "#String#bytesize" do
    it "needs to be reviewed for spec completeness"

    it "returns the length of self in bytes" do
      "hello".bytesize.should == 5
      " ".bytesize.should == 1
    end
    
    it "works with strings containing single UTF-8 characters" do
      "\u{6666}".bytesize.should == 3
    end

    it "works with psuedo-ASCII strings containing single UTF-8 characters" do
      "\u{6666}".force_encoding('ASCII-8BIT').bytesize.should == 3
    end
    
    it "works with strings containing UTF-8 characters" do
      "c \u{6666}".force_encoding('UTF-8').bytesize.should == 5
      "c \u{6666}".bytesize.should == 5
    end
    
    it "works with psuedo-ASCII strings containing UTF-8 characters" do
      "c \u{6666}".force_encoding('ASCII-8BIT').bytesize.should == 5
    end
    
    it "returns 0 for the empty string" do
      "".bytesize.should == 0
      "".force_encoding('ASCII-8BIT').bytesize.should == 0
      "".force_encoding('UTF-8').bytesize.should == 0
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/string/bytesize_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/string/bytesize_spec.rb