Sha256: ab58d7ef96631bf8de0804d9e4c4d47e870cd8be423457a2263a0684ece98bdd

Contents?: true

Size: 459 Bytes

Versions: 33

Compression:

Stored size: 459 Bytes

Contents

require 'spec_helper'

describe "String#each_byte" do
  it "get bytes from UTF-8 character (2 bytes)" do
    a = []
    "ʆ".each_byte { |c| a << c }
    a.should == [202, 134]
  end
  it "get bytes from UTF-8 character (3 bytes)" do
    a = []
    "ቜ".each_byte { |c| a << c }
    a.should == [225, 137, 156]
  end
  it "get bytes from UTF-8 emoji (4 bytes)" do
    a = []
    "👋".each_byte { |c| a << c }
    a.should == [240, 159, 145, 139]
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 spec/opal/core/string/each_byte_spec.rb
opal-1.8.2 spec/opal/core/string/each_byte_spec.rb
opal-1.8.1 spec/opal/core/string/each_byte_spec.rb
opal-1.8.0 spec/opal/core/string/each_byte_spec.rb
opal-1.8.0.beta1 spec/opal/core/string/each_byte_spec.rb
opal-1.7.4 spec/opal/core/string/each_byte_spec.rb
opal-1.8.0.alpha1 spec/opal/core/string/each_byte_spec.rb
opal-1.7.3 spec/opal/core/string/each_byte_spec.rb
opal-1.7.2 spec/opal/core/string/each_byte_spec.rb
opal-1.7.1 spec/opal/core/string/each_byte_spec.rb
opal-1.7.0 spec/opal/core/string/each_byte_spec.rb
opal-1.7.0.rc1 spec/opal/core/string/each_byte_spec.rb
opal-1.6.1 spec/opal/core/string/each_byte_spec.rb
opal-1.6.0 spec/opal/core/string/each_byte_spec.rb
opal-1.6.0.rc1 spec/opal/core/string/each_byte_spec.rb
opal-1.6.0.alpha1 spec/opal/core/string/each_byte_spec.rb
opal-1.5.1 spec/opal/core/string/each_byte_spec.rb
opal-1.5.0 spec/opal/core/string/each_byte_spec.rb
opal-1.5.0.rc1 spec/opal/core/string/each_byte_spec.rb
opal-1.4.1 spec/opal/core/string/each_byte_spec.rb